Module: RSpec::Matchers::DSL::DefaultImplementations
- Included in:
- Matcher
- Defined in:
- lib/rspec/matchers/dsl.rb
Overview
Defines default implementations of the matcher
protocol methods for custom matchers. You can
override any of these using the Macros methods
from within an RSpec::Matchers.define block.
Instance Method Summary collapse
-
#description ⇒ Object
The default description.
-
#diffable? ⇒ Boolean
private
Used internally by objects returns by
shouldandshould_not. -
#failure_message ⇒ Object
The default failure message for positive expectations.
-
#failure_message_when_negated ⇒ Object
The default failure message for negative expectations.
-
#supports_block_expectations? ⇒ Boolean
Matchers do not support block expectations by default.
Instance Method Details
#description ⇒ Object
The default description.
253 254 255 |
# File 'lib/rspec/matchers/dsl.rb', line 253 def description "#{name_to_sentence}#{to_sentence expected}" end |
#diffable? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Used internally by objects returns by should and should_not.
248 249 250 |
# File 'lib/rspec/matchers/dsl.rb', line 248 def diffable? false end |
#failure_message ⇒ Object
The default failure message for positive expectations.
258 259 260 |
# File 'lib/rspec/matchers/dsl.rb', line 258 def "expected #{actual.inspect} to #{name_to_sentence}#{to_sentence expected}" end |
#failure_message_when_negated ⇒ Object
The default failure message for negative expectations.
263 264 265 |
# File 'lib/rspec/matchers/dsl.rb', line 263 def "expected #{actual.inspect} not to #{name_to_sentence}#{to_sentence expected}" end |
#supports_block_expectations? ⇒ Boolean
Matchers do not support block expectations by default. You must opt-in.
269 270 271 |
# File 'lib/rspec/matchers/dsl.rb', line 269 def supports_block_expectations? false end |