I am trying to port my application from Rails 3.2.x to Rails 4.0.4. All the gems have been made compatible and I am in the phase of fixing failing tests.
I have this weird test failure.
My routes.rb
resources :my_reports, only: [:index] do
collection do
get "/report/:filename", to: :show, prefix: "pri/excl/rep", as: :show
end
end
My spec which has been passing in Rails 3.2.x and now failing after update to 4.0.4
describe MyReportsController do
describe "#show" do
def make_request
get :show, prefix: 'some/place', filename: 'foo', format: 'doc'
end
it "makes a simple request" do
make_request
end
end
end
I am getting the following error
Failure/Error: get :show, prefix: 'some/place', filename: 'foo', format: 'doc'
ActionController::UrlGenerationError:
No route matches {:action=>"show", :controller=>"my_reports",
:filename=>"foo", :format=>"doc", :prefix=>"some/place"}
I am stuck at this point, hints are welcome. I am using rspec and rspec-rails versions 2.14.1.
Passing a dummy :id in the test fixed the issue for me although I would not like it, tests pass.
get :show, id: "", prefix: 'some/place', filename: 'foo', format: 'doc'
Refer to state of rails releases here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With