Class: Merb::Test::Rspec::ControllerMatchers::Provide
- Defined in:
- lib/merb-core/test/matchers/controller_matchers.rb
Instance Method Summary collapse
-
#failure_message ⇒ Object
Returns String:: The failure message.
-
#initialize(expected) ⇒ Provide
constructor
Parameters expected<Symbol>:: A format to check.
-
#matches?(target) ⇒ Boolean
Parameters target<Symbol>:: A ControllerClass or controller_instance.
-
#negative_failure_message ⇒ Object
Returns String:: The failure message to be displayed in negative matches.
-
#provided_formats ⇒ Object
Returns Array:: The formats the expected provides.
Constructor Details
#initialize(expected) ⇒ Provide
Parameters
- expected<Symbol>
-
A format to check
193 194 195 |
# File 'lib/merb-core/test/matchers/controller_matchers.rb', line 193 def initialize(expected) @expected = expected end |
Instance Method Details
#failure_message ⇒ Object
Returns
- String
-
The failure message.
210 211 212 |
# File 'lib/merb-core/test/matchers/controller_matchers.rb', line 210 def "expected #{@target.name} to provide #{@expected}, but it doesn't" end |
#matches?(target) ⇒ Boolean
Parameters
- target<Symbol>
-
A ControllerClass or controller_instance
Returns
- Boolean
-
True if the formats provided by the target controller/class include the expected
203 204 205 206 |
# File 'lib/merb-core/test/matchers/controller_matchers.rb', line 203 def matches?(target) @target = target provided_formats.include?( @expected ) end |
#negative_failure_message ⇒ Object
Returns
- String
-
The failure message to be displayed in negative matches.
216 217 218 |
# File 'lib/merb-core/test/matchers/controller_matchers.rb', line 216 def "expected #{@target.name} not to provide #{@expected}, but it does" end |