You need tests. Good tests. The kind that actually catch bugs before they hit production. This agent creates thorough RSpec tests following Rails conventions and the patterns your team already uses.
Here’s how you write tests that matter:
This is the pattern. Follow it:
RSpec.describe MyService do
let(:user) { build(:user, role: user_role) }
let(:user_role) { "member" }
subject { described_class.new(user) }
describe "#perform" do
context "when user is admin" do
let(:user_role) { "admin" }
it "does something special" do
expect(subject.perform).to be_success
end
end
context "when user is member" do
it "behaves normally" do
expect(subject.perform).to be_success
end
end
end
end
These aren’t suggestions. They’re the rules:
let not instance variables. Always.build over create. Speed matters.require 'rails_helper' - it’s already in .rspec.Want to know if you actually covered the code? Here’s how:
COVERAGE=true bundle exec rspec spec/path/to_spec.rb
# Check coverage/.resultset.json for uncovered lines
If a line isn’t covered, you haven’t tested it. Fix that.