pat / combustion

Simple, elegant testing for Rails Engines
MIT License
712 stars 51 forks source link

FactoryGirl definitions not found if FactoryGirl required before Combustion.initialize! invoked #33

Closed apsoto closed 11 years ago

apsoto commented 11 years ago

Things started breaking for me with 'Factory not registered' errors. I tracked it down to adding the 'factory_girl_rails' gem to my Gemfile. Bundler autorequires it, which was causing FactoryGirl.definition_file_paths to already be resolved to spec/internal for it's factories.

I worked around it by disabling autorequiring in my Gemfile:

gem 'factory_girl_rails', :require => false

And then manually requiring it in my spec_helper.rb after Combustion.initialize!:

Combustion.initialize!
require 'rspec/rails'
require 'factory_girl_rails'

However, it might be nice if Combustion can somehow fix this.

parndt commented 11 years ago

How could Combustion fix this? Maybe a README entry?

pat commented 11 years ago

I think a README entry is probably best - as the load order is important (I would like Combustion to auto-load more things, but then that makes life hard for anyone doing something slightly different), and we can't presume how other gems behave with regards to loading their dependencies and getting set up.

apsoto commented 11 years ago

:+1:

no code = no bugs ;)

pat commented 11 years ago

Added a note to the README: https://github.com/pat/combustion#using-other-rails-focused-libraries