Testing Attribute Name Handling and Association Status in factory_bot
This test suite examines the core functionality of FactoryBot’s Attribute class, focusing on name attribute handling and association behavior. The tests verify proper symbol conversion and association status checking, ensuring reliable factory attribute management in Ruby applications.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
thoughtbot/factory_bot
spec/factory_bot/attribute_spec.rb
describe FactoryBot::Attribute do
it "converts the name attribute to a symbol" do
name = "user"
attribute = FactoryBot::Attribute.new(name, false)
expect(attribute.name).to eq name.to_sym
end
it "is not an association" do
name = "user"
attribute = FactoryBot::Attribute.new(name, false)
expect(attribute).not_to be_association
end
end