organizing_spec_files
π Organize Spec Files for Clarityβ
Keep your spec/
directory structured similarly to lib/
or app/
directories. This helps you locate tests quickly and ensures each class or module has corresponding specs.
my_project/
βββ app/
β βββ models/
β βββ user.rb
βββ spec/
βββ models/
βββ user_spec.rb
In user_spec.rb
, reference the file under test:
require_relative '../../app/models/user'
describe User do
# your tests...
end