testinglisted
Install: claude install-skill ghozimahdi/gm-aiagent-plugins
## Testing Patterns
### Framework
- **Minitest** (NOT RSpec)
- **Capybara** + Selenium for system tests
- **Fixtures** for test data (NOT factories)
### Running Tests
```bash
bin/rails test # All tests
bin/rails test:system # System tests
bin/rails test test/models/ # Directory
bin/rails test test/models/user_test.rb # File
bin/rails test test/models/user_test.rb:15 # Line
```
### Model Tests
```ruby
class TaskTest < ActiveSupport::TestCase
test "validates presence of title" do
task = Task.new(title: nil)
assert_not task.valid?
assert_includes task.errors[:title], "can't be blank"
end
test "soft deletes with paranoia" do
task = tasks(:active)
task.destroy
assert_not_nil task.deleted_at
assert_not Task.exists?(task.id)
assert Task.only_deleted.exists?(task.id)
end
test "advances status from pending to in_progress" do
task = tasks(:pending)
task.advance!
assert task.in_progress?
end
test "scopes due_soon returns tasks due within 3 days" do
assert_includes Task.due_soon, tasks(:due_tomorrow)
assert_not_includes Task.due_soon, tasks(:due_next_month)
end
end
```
### Controller Tests
```ruby
class Admin::UsersControllerTest < ActionDispatch::IntegrationTest
setup do
@admin = admins(:default)
sign_in @admin
end
test "should get index" do
get admin_users_url
assert_response :success
end
test "should create user" do
assert_differe