module RSpec::Rails::ControllerExampleGroup
def bypass_rescue
end
end.to raise_error(/403 Forbidden/)
get :show, id: profile.id + 1
bypass_rescue
expect do
login_as profile.user
profile = create_profile
it "raises a 403 when a non-admin user tries to view another user's profile" do
describe ProfilesController do
@example
conditions.
specify that an action _should_ raise an exception given appropriate
`rescue_with_handler` to raise the exception passed to it. Use this to
Extends the controller with a module that overrides
def bypass_rescue controller.extend(BypassRescue) end