module RSpec::Rails::ControllerExampleGroup
Attributes
controller[R]
routes[R]
Public Instance Methods
bypass_rescue()
click to toggle source
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
method_missing(method, *args, &block)
click to toggle source
If method is a named_route, delegates to the RouteSet associated with this controller.
Calls superclass method
# 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 defined?(@orig_routes) && @orig_routes && @orig_routes.named_routes.helpers.include?(method) controller.send(method, *args, &block) else super end end
routes=(routes)
click to toggle source
@api private
# File lib/rspec/rails/example/controller_example_group.rb, line 100 def routes=(routes) @routes = routes assertion_instance.instance_variable_set(:@routes, routes) end