用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/instructure/canvas-lms --skill rspec命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | rspec |
| description | MUST use this skill when writing, reviewing, or modifying Ruby RSpec tests (*_spec.rb) in Canvas |
When writing or reviewing RSpec tests in Canvas, there are several guidelines to ensure tests are effective and maintainable. Canvas' codebase is quite old, so there are many legacy tests that don't follow modern best practices.
let and let! for defining test data instead of instance variables. This provides better scoping and lazy loading of test data. This also applies to using let instead of before blocks for setting up test data.let_once to define it. This will create the object once and reuse it across examples, improving test performance.subject, remember that it's a noun -- don't use it as a way to perform a common action across multiple examples. The subject should be the object under test. If you want to perform a common action across multiple examples, write a method. You can call that in each action. Or use a before block if it makes sense.let, before blocks, helper methods, or shared context as appropriate. This will make your tests more DRY and easier to read.create! on the model. Simply pass your attributes directly to create! yourself. If you find yourself wanting to infer the same values over and over, consider a before_validation hook on the model that can infer them for you.double unless absolutely necessary. instance_double and class_double provide better guarantees that your test doubles are accurate representations of the real objects.describe "#method_name" or describe ".class_method_name" block.describe "HTTP_METHOD action_name" block (e.g. describe "GET index").Class.new), and assign it either with let or stub_const.be asserts object identity -- use it for numbers, symbols, true, false, nil, or when you specifically want to assert that two variables point to the same object.eql asserts that two values are not just semantically the same, but also of the same type without conversions -- this should be the most commonly used matcher for types like strings, arrays, hashes, and custom objects.eq asserts that two values are semantically the same, allowing for type conversions.