I have a problem with testing the rails 3 admin controller. It looks like the controller action is not even being called. I tested this, indicating that the action is clearly throwing an exception, and the test does not show this fact.
with the following code, my test passes. the exception should cause the test to fail if my_custom_action is actually called.
Controllers / admin / things_controller.rb
class Admin::ThingsController < Admin::AdminController
def my_custom_action
raise 'this should be bad'
end
end
specifications / controllers / admin / things_controller_spec.rb
describe Admin::ThingsController do
it "shouldn't work!" do
post :my_custom_action
end
end
config / routes.rb
namespace :admin do
resources :things do
post :my_custom_action, :on => :collection
end
end
whenever I delete a route, the test fails with the error "there is no corresponding route", so I'm rather confused by why it seems that when the route is determined, the action is not called
namespace'd rspec?