RSpec and included member routes in a resource
Closed this issue · 2 comments
ccocchi commented
Given the following routes
focused_controller_routes do
resources :posts do
get :something, on: :member
end
end
and the following functionnal test
require 'spec_helper'
require 'focused_controller/rspec_functional_helper'
describe PostsController do
include FocusedController::RSpecFunctionalHelper
describe PostsController::Something do
it "should not raise an error" do
get
end
end
end
I got the this error
1) PostsController PostsController::Something should not raise an error
Failure/Error: get
ActionController::RoutingError:
No route matches {:controller=>"posts_controller/something", :action=>"call"}
This action works perfectly when accessed via a browser and routes seem to be correctly defined when running rake routes
ccocchi commented
It seems also to be the same problem with routes inside a scope such as
scope 'foos' do
get '/bar' => 'foos#bar'
end
Trying to test FoosController::Bar will raise the same RoutingError
ccocchi commented
It is better to supply an id
to a member route... :s