In the rails project, I would like to put factory_girl plants in spec/support/factories/ instead of spec/factories/ (since later there are already specifications for factory classes).
Here is my spec_helper.rb :
# This file is copied to spec/ when you run 'rails generate rspec:install' ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'rspec/autorun' require 'capybara/rails' require 'capybara/rspec' FactoryGirl.definition_file_paths = [File.join(Rails.root, 'spec', 'support', 'factories')]
But when I run rspec , the files in spec/factories are still loaded twice (using both factory_girl and rspec ), which leads to duplication of test execution.
I do not think that FactoryGirl.factories.clear can help me, nor FactoryGirl.reload , since they will not prevent the tests from running.
Is it possible to simply prevent factory_girl from loading spec/factories/ ?
(Using ruby 1.9.3p327 , rails 3.2.9 , factory_girl 4.1.0 , factory_girl_rails 4.1.0 , rspec-core 2.12.2 and rspec-rails 2.12.0 )
source share