Class: Merb::Test::Rspec::ControllerMatchers::BeMissing
- 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.
-
#status_code ⇒ Object
Returns Fixnum:: Either the target’s status or the target itself.
Instance Method Details
#failure_message ⇒ Object
Returns
- String
-
The failure message.
138 139 140 |
# File 'lib/merb-core/test/matchers/controller_matchers.rb', line 138 def "expected#{inspect_target} to be missing but was #{status_code}" end |
#inspect_target ⇒ Object
Returns
- String
-
The controller and action name.
150 151 152 |
# File 'lib/merb-core/test/matchers/controller_matchers.rb', line 150 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 400..417.
131 132 133 134 |
# File 'lib/merb-core/test/matchers/controller_matchers.rb', line 131 def matches?(target) @target = target (400..417).include?(status_code) end |
#negative_failure_message ⇒ Object
Returns
- String
-
The failure message to be displayed in negative matches.
144 145 146 |
# File 'lib/merb-core/test/matchers/controller_matchers.rb', line 144 def "expected#{inspect_target} not to be missing but it was #{status_code}" end |
#status_code ⇒ Object
Returns
- Fixnum
-
Either the target’s status or the target itself.
156 157 158 |
# File 'lib/merb-core/test/matchers/controller_matchers.rb', line 156 def status_code @target.respond_to?(:status) ? @target.status : @target end |