Curated library of AI agent skills for Ruby on Rails development. Covers code review, architecture, security, testing (RSpec), engines, service objects, DDD patterns, and workflow automation.
98
99%
Does it follow best practices?
Impact
98%
1.38xAverage score across 26 eval scenarios
Passed
No known issues
A SaaS platform sends users notifications when important events occur: account suspension warnings, password change confirmations, and billing failures. The backend team recently completed Notifications::UserNotifier, a service object that dispatches different notification types via email. A code review flagged that this service has no test coverage, and the PR cannot be merged until specs are in place.
You have been asked to write a comprehensive RSpec spec file for Notifications::UserNotifier. The service lives at app/services/notifications/user_notifier.rb. Your spec file should be organized to reflect the structure of the service and provide clear, readable examples that any team member can understand at a glance.
Note: This project does NOT use test-prof or any performance-enhancing spec helpers beyond standard RSpec.
The following file is provided. Extract it before beginning.
=============== FILE: app/services/notifications/user_notifier.rb ===============
module Notifications class UserNotifier VALID_EVENTS = %w[suspension_warning password_changed billing_failure].freeze DEFAULT_SENDER = 'noreply@example.com'.freeze
def self.call(user_id:, event_type:)
new(user_id: user_id, event_type: event_type).call
end
def initialize(user_id:, event_type:)
@user_id = user_id
@event_type = event_type
end
def call
return { success: false, response: { error: 'Invalid event type' } } unless VALID_EVENTS.include?(@event_type)
return { success: false, response: { error: 'User not found' } } if @user_id.nil?
# TODO: load user from database and dispatch email
{ success: true, response: { delivered: true, event: @event_type } }
end
private
def valid_event?
VALID_EVENTS.include?(@event_type)
endend end
Produce a single spec file for the service. The spec should cover:
The spec file should be placed at the mirrored path under spec/ and follow standard RSpec conventions for structure and test data setup.
api-rest-collection
create-prd
ddd-boundaries-review
ddd-rails-modeling
ddd-ubiquitous-language
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
scenario-11
scenario-12
scenario-13
scenario-14
scenario-15
scenario-16
scenario-17
scenario-18
scenario-19
scenario-20
scenario-21
scenario-22
scenario-23
scenario-24
scenario-25
scenario-26
generate-tasks
mcp_server
rails-architecture-review
rails-background-jobs
rails-bug-triage
rails-code-conventions
rails-code-review
rails-engine-compatibility
rails-engine-docs
rails-engine-extraction
rails-engine-installers
rails-engine-release
rails-engine-reviewer
rails-engine-testing
rails-graphql-best-practices
rails-migration-safety
rails-review-response
rails-security-review
rails-skills-orchestrator
rails-stack-conventions
rails-tdd-slices
refactor-safely
rspec-best-practices
rspec-service-testing
ruby-service-objects
strategy-factory-null-calculator
ticket-planning
yard-documentation