Extends the controller with a module that overrides `rescue_with_handler` to raise the exception passed to it. Use this to specify that an action should raise an exception given appropriate conditions.
@example
describe ProfilesController do
it "raises a 403 when a non-admin user tries to view another user's profile" do
profile = create_profile
login_as profile.user
expect do
bypass_rescue
get :show, :id => profile.id + 1
end.to raise_error(/403 Forbidden/)
end
end
# File lib/rspec/rails/example/controller_example_group.rb, line 129 def bypass_rescue controller.extend(BypassRescue) end
If method is a named_route, delegates to the RouteSet associated with this controller.
# File lib/rspec/rails/example/controller_example_group.rb, line 135 def method_missing(method, *args, &block) if @routes && @routes.named_routes.helpers.include?(method) controller.send(method, *args, &block) elsif @orig_routes && @orig_routes.named_routes.helpers.include?(method) controller.send(method, *args, &block) else super end end
Generated with the Darkfish Rdoc Generator 2.