I am trying to reset the "sequence" in a factory girl between each run of the test.
( factory_girl 2.6.0
and factory_girl_rails 1.7.0
)
I think for this I need to reload FactoryGirl definitions. I do this in the last lines of spec_helper.rb:
require 'rubygems' require 'spork'
Addendum:
FactoryGirl.definition_file_paths = [File.join(Rails.root, 'spec', 'factories')] FactoryGirl.find_definitions
Leads me to the following error when running rspec spec/
โ bundle exec guard Guard uses Growl to send notifications. Guard is now watching at '/Rails/projects/MyRailsProject' Starting Spork for RSpec Using RSpec Preloading Rails environment Loading Spork.prefork block... Spork is ready and listening on 8989! Spork server for RSpec successfully started Guard::RSpec is running, with RSpec 2! Running all specs Exception encountered:
This seems to be a duplicate factory error, maybe it is trying to load the factory girl twice, but I donโt understand why.
Goles source share