Class: Merb::Test::Rspec::ControllerMatchers::BeRedirect
- Defined in:
- lib/merb-core/test/matchers/controller_matchers.rb
Instance Method Summary collapse
-
#failure_message ⇒ Object
Returns String:: The failure message.
-
#inspect_target ⇒ Object
Returns String:: The controller and action name.
-
#matches?(target) ⇒ Boolean
Parameters target<Fixnum, ~status>:: Either the status code or a controller with a status code.
-
#negative_failure_message ⇒ Object
Returns String:: The failure message to be displayed in negative matches.
Instance Method Details
#failure_message ⇒ Object
Returns
- String
-
The failure message.
18 19 20 |
# File 'lib/merb-core/test/matchers/controller_matchers.rb', line 18 def "expected#{inspect_target} to redirect" end |
#inspect_target ⇒ Object
Returns
- String
-
The controller and action name.
30 31 32 |
# File 'lib/merb-core/test/matchers/controller_matchers.rb', line 30 def inspect_target " #{@target.controller_name}##{@target.action_name}" if @target.respond_to?(:controller_name) && @target.respond_to?(:action_name) end |
#matches?(target) ⇒ Boolean
Parameters
- target<Fixnum, ~status>
-
Either the status code or a controller with a status code.
Returns
- Boolean
-
True if the status code is in the range 300..305 or 307.
11 12 13 14 |
# File 'lib/merb-core/test/matchers/controller_matchers.rb', line 11 def matches?(target) @target = target [307, *(300..305)].include?(target.respond_to?(:status) ? target.status : target) end |
#negative_failure_message ⇒ Object
Returns
- String
-
The failure message to be displayed in negative matches.
24 25 26 |
# File 'lib/merb-core/test/matchers/controller_matchers.rb', line 24 def "expected#{inspect_target} not to redirect" end |