0

Based on this stackoverflow q, adding the following line solves the same problem faced that is explained in the question:

before(:each) { @routes = MyEngine::Engine.routes }

The last part of the thread explains that I do not have to add that line in every controller file if I add the following:

#spec/spec_helper.rb
RSpec.configure do |config|
  # other code
  config.before(:each) { @routes = MyEngine::Engine.routes }
end

However, this last part doesn't seem to work. Any idea why?

Thanks!

Update 1 example error message:

11) Core::PostsController PUT update with valid params assigns the requested post as @post
     Failure/Error: put :update, {:id => post.to_param, :post => valid_attributes}, valid_session
     ActionController::UrlGenerationError:
       No route matches {:id=>"1", :post=>{}, :controller=>"core/posts", :action=>"update"}
     # ./spec/controllers/core/posts_controller_spec.rb:115:in `block (4 levels) in <module:Core>'
Community
  • 1
  • 1
Karan
  • 14,824
  • 24
  • 91
  • 157

0 Answers0