ruby on rails 3.1 - How to resolve the cache_clases = true/false conflict using Spork, RSpec & Cucumber? -
ruby on rails 3.1 - How to resolve the cache_clases = true/false conflict using Spork, RSpec & Cucumber? -
i had problems ages in rspec models not beingness reloaded between spork runs.
i fixed changing next line in config/environments/test.rb
:
config.cache_classes = true
became
config.cache_classes = false
however... while solved issues rspec, cucumber requires cache_classes set true. https://rspec.lighthouseapp.com/projects/16211/tickets/165
is there canonical solution works both rspec , cucumber , reloads rspec models successfully?
footnote
* other changes implemented create rspec reload models included adding next lines spec_helper.rb
:
activesupport::dependencies.clear factorygirl.reload
none of these lines solved problem without setting cache_classes=true
line.
i had problem, , me due rails' threadsafe mode. ensuring config.threadsafe! not called in test environment fixed me. because threadsafe mode prevents code reloading on each request , disables automatic dependency loading, guess spork relying on in each_run.
i calling config.threadsafe! in application.rb, removed phone call there, , set in development.rb , production.rb instead. can leave config.cache_classes set true, , rspec , cucumber work happily under spork. note using mongoid in persistence layer , machinist instead of factorygirl ymmv.
see http://rickyrobinson.id.au/2012/07/20/when-spork-puts-a-fork-in-your-cucumber-and-a-spanner-in-your-specs
ruby-on-rails-3.1 rspec cucumber spork
Comments
Post a Comment