Module: RSpec::Rails::ControllerExampleGroup
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActionController::TestCase::Behavior, Matchers::RedirectTo, Matchers::RenderTemplate, Matchers::RoutingMatchers, RailsExampleGroup, ViewRendering
- Defined in:
- lib/rspec/rails/example/controller_example_group.rb
Defined Under Namespace
Modules: BypassRescue, ClassMethods
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#routes ⇒ Object
Returns the value of attribute routes.
Instance Method Summary collapse
-
#bypass_rescue ⇒ Object
Extends the controller with a module that overrides
rescue_with_handler
to raise the exception passed to it. -
#method_missing(method, *args, &block) ⇒ Object
If method is a named_route, delegates to the RouteSet associated with this controller.
Methods included from Matchers::RoutingMatchers
Methods included from Matchers::RenderTemplate
Methods included from Matchers::RedirectTo
Methods included from ViewRendering
Methods included from Matchers
#be_a_new, #be_new_record, #be_valid
Methods included from MinitestLifecycleAdapter
#after_setup, #after_teardown, #before_setup, #before_teardown
Methods included from SetupAndTeardownAdapter
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
If method is a named_route, delegates to the RouteSet associated with this controller.
136 137 138 139 140 141 142 143 144 |
# File 'lib/rspec/rails/example/controller_example_group.rb', line 136 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 |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
98 99 100 |
# File 'lib/rspec/rails/example/controller_example_group.rb', line 98 def controller @controller end |
#routes ⇒ Object
Returns the value of attribute routes.
98 99 100 |
# File 'lib/rspec/rails/example/controller_example_group.rb', line 98 def routes @routes end |
Instance Method Details
#bypass_rescue ⇒ Object
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.
130 131 132 |
# File 'lib/rspec/rails/example/controller_example_group.rb', line 130 def bypass_rescue controller.extend(BypassRescue) end |