1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00

Refactor null_factory_spec.rb to conform to Let's Not style (#1347)

This commit is contained in:
Richie Thomas 2019-10-23 14:19:40 -07:00 committed by GitHub
parent ba3b937111
commit 877646eeac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,11 +1,49 @@
describe FactoryBot::NullFactory do describe FactoryBot::NullFactory do
it { should delegate(:defined_traits).to(:definition) } it "delegates defined traits to its definition" do
it { should delegate(:callbacks).to(:definition) } null_factory = FactoryBot::NullFactory.new
it { should delegate(:attributes).to(:definition) }
it { should delegate(:constructor).to(:definition) }
its(:compile) { should be_nil } expect(null_factory).to delegate(:defined_traits).to(:definition)
its(:class_name) { should be_nil } end
its(:attributes) { should be_an_instance_of(FactoryBot::AttributeList) }
its(:evaluator_class) { should eq FactoryBot::Evaluator } it "delegates callbacks to its definition" do
null_factory = FactoryBot::NullFactory.new
expect(null_factory).to delegate(:callbacks).to(:definition)
end
it "delegates attributes to its definition" do
null_factory = FactoryBot::NullFactory.new
expect(null_factory).to delegate(:attributes).to(:definition)
end
it "delegates constructor to its definition" do
null_factory = FactoryBot::NullFactory.new
expect(null_factory).to delegate(:constructor).to(:definition)
end
it "has a nil value for its compile attribute" do
null_factory = FactoryBot::NullFactory.new
expect(null_factory.compile).to be_nil
end
it "has a nil value for its class_name attribute" do
null_factory = FactoryBot::NullFactory.new
expect(null_factory.class_name).to be_nil
end
it "has an instance of FactoryBot::AttributeList for its attributes attribute" do
null_factory = FactoryBot::NullFactory.new
expect(null_factory.attributes).to be_an_instance_of(FactoryBot::AttributeList)
end
it "has FactoryBot::Evaluator as its evaluator class" do
null_factory = FactoryBot::NullFactory.new
expect(null_factory.evaluator_class).to eq FactoryBot::Evaluator
end
end end