ruby on rails - Rspec passes on individual spec files but fails on whole directory -
i have model section belongs course, teacher, , semester.
i have factory girl definition looks this:
factory :section course teacher semester sequence(:section_number) {|n| "n"} days_of_week ["m", "w", "f", ""] time_block "7:45-9:15" end
i have no uniqueness validations on of associated models or on section.
i have 2 rspec files need create section. if run rspec on each file individually, both pass, if run rspec on whole directory, 1 fails every time because section nil. it's not same file fails each time...
failure/error: section = factorygirl.create(:section) nomethoderror: undefined method `join' nil:nilclass
even if call factory girl in rails console, create first section correctly , subsequent calls results in nil section.
i'm out of ideas on why happening... have plenty of other factories work properly.
your consequent selection
factory never unique. using sequence
section_number
, using string
"n".
try replacing
sequence(:section_number) {|n| "n"}
with
sequence(:section_number) {|n| n}
instead , see if works you.
Comments
Post a Comment