← ClaudeAtlas

write-testslisted

Generate RSpec tests for a Ruby class or module following project BDD conventions (verified doubles, comprehensive coverage). TRIGGER when the user wants tests written/generated for a Ruby class or module. Do NOT trigger to run an existing suite or to debug a specific failure (use diagnose).
mik2win/foureyes · ★ 2 · AI & Automation · score 76
Install: claude install-skill mik2win/foureyes
# Write Tests Generate an RSpec spec file for the given Ruby class or module. ## Input `$ARGUMENTS` — relative path to the file under test (e.g., `lib/services/order_fulfiller.rb`). If `$ARGUMENTS` is empty, ask the developer which file to test and stop. ## Procedure ### 1. Read the target file Read the file at `$ARGUMENTS`. Identify: - Class/module name and namespace - Public methods (instance and class) - Constructor parameters and dependencies (injected collaborators) - Return values, side effects, raised exceptions - Inheritance and included modules ### 2. Determine the object type Detect what kind of object it is and adjust coverage accordingly: | Type | Detection hints | What to test | |------|----------------|--------------| | **Model** | Inherits from a base model, lives in `models/` | Validations, associations, scopes, instance methods, class methods, callbacks with side effects | | **Service** | Lives in `services/`, has `#call` | `#call` happy path, failure paths, side effects on collaborators, return value | | **Form Object** | Lives in `forms/`, includes `ActiveModel` | Validation rules, `#submit`/`#save` behavior, multi-model persistence | | **Policy** | Lives in `policies/`, methods return boolean | Each policy method with different roles/contexts | | **Query Object** | Lives in `queries/`, returns relations/collections | Various parameter combinations, empty results, edge cases | | **Controller** | Lives in `controllers/` | Request specs: HTTP statu