sporkrb / spork-rails

Spork plugin for rails
MIT License
184 stars 45 forks source link

Routes are not reloaded #4

Closed inkstak closed 11 years ago

inkstak commented 12 years ago

Routes are not reloaded at each run.

I need to make it on the app side, for each test suite (rspec, cucumber) :

Spork.each_run do
  ...
  load "#{Rails.root}/config/routes.rb"
 ...
end

Am currently trying to fix it on my fork, but maybe someone already tried...

assembler commented 12 years ago

Refer to this https://github.com/sporkrb/spork/wiki/Spork.trap_method-Jujitsu (Devise / Routes / etc section)

Basically, all you have to do is to add following in your Sprok.prefork block:

Spork.trap_method(Rails::Application::RoutesReloader, :reload!)
inkstak commented 12 years ago

Thanks for the trick. It will be useful.

But I'll have to think to add that each time I use spork in any test suite in each app I'll do. So, ok, that's not a big deal, I think I can do it but, is this not the concern of spork-rails ?

Could it be integrated by default into the gem ?

assembler commented 12 years ago

You are absolutely right. That is spork-rails concern and should be integrated into gem.

sahilm commented 11 years ago

Closing old bugs. If you feel this issue still needs resolution, please open a new issue.

Thanks.