Hi,
I am trying to use a factory with traits in a rubygem (non-rails environment), and I am getting this error:
1) Footprint::Model with tracking enabled while walking will leave an impression when born
Failure/Error: yeti = FactoryGirl.create(:yeti)
NoMethodError:
undefined method `to_sym' for #<FactoryGirl::Declaration::Implicit:0x007fb982ba18d0>
# ./spec/footprint/track_spec.rb:13:in `block (5 levels) in <top (required)>'
Spec is:
context "while walking" do
context "will leave an impression" do
it "when born" do
yeti = FactoryGirl.create(:yeti)
end
end
end
And the factory is:
FactoryGirl.define do
factory :yeti do
sequence(name) { |n| "Yeti#{n}" }
notes "Yet to Start Tracking"
region "Himalayas"
trait :male do
gender "Male"
end
trait :female do
gender "Female"
end
factory :male_yeti, traits: [:male]
factory :female_yeti, traits: [:female]
end
end
I am sure this is a trivial issue. Can somebody point me in the right direction?
I am using factory_girl (4.1.0).
My bad... Found the problem.
sequence(name) should be sequence(:name)
@subhashb yep, that's exactly what I was going to say! Nice catch!
Most helpful comment
My bad... Found the problem.
sequence(name)should besequence(:name)