Module: RSpec::Matchers::DSL::DefaultImplementations
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
|
|
Defined in: | rspec-expectations/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 Attribute Summary
-
#diffable? ⇒ Boolean
readonly
Internal use only
Internal use only
Used internally by objects returns by
should
andshould_not
. -
#expects_call_stack_jump? ⇒ Boolean
readonly
Most matchers do not expect call stack jumps.
-
#supports_block_expectations? ⇒ Boolean
readonly
::RSpec::Matchers
do not support block expectations by default. - #supports_value_expectations? ⇒ Boolean readonly
Instance Method Summary
-
#description
The default description.
- #chained_method_clause_sentences private
::RSpec::Matchers::BuiltIn::BaseMatcher::DefaultFailureMessages
- Included
#failure_message | Provides a good generic failure message. |
#failure_message_when_negated | Provides a good generic negative failure message. |
Instance Attribute Details
#diffable? ⇒ Boolean
(readonly)
This method is for internal use only.
Used internally by objects returns by should
and should_not
.
# File 'rspec-expectations/lib/rspec/matchers/dsl.rb', line 390
def diffable? false end
#expects_call_stack_jump? ⇒ Boolean
(readonly)
Most matchers do not expect call stack jumps.
# File 'rspec-expectations/lib/rspec/matchers/dsl.rb', line 412
def expects_call_stack_jump? false end
#supports_block_expectations? ⇒ Boolean
(readonly)
::RSpec::Matchers
do not support block expectations by default. You must opt-in.
# File 'rspec-expectations/lib/rspec/matchers/dsl.rb', line 403
def supports_block_expectations? false end
#supports_value_expectations? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'rspec-expectations/lib/rspec/matchers/dsl.rb', line 407
def supports_value_expectations? true end
Instance Method Details
#chained_method_clause_sentences (private)
[ GitHub ]# File 'rspec-expectations/lib/rspec/matchers/dsl.rb', line 418
def chained_method_clause_sentences return '' unless Expectations.configuration.include_chain_clauses_in_custom_matcher_descriptions? @chained_method_clauses.map do |(method_name, method_args)| english_name = EnglishPhrasing.split_words(method_name) arg_list = EnglishPhrasing.list(method_args) " #{english_name}#{arg_list}" end.join end
#description
The default description.
# File 'rspec-expectations/lib/rspec/matchers/dsl.rb', line 395
def description english_name = EnglishPhrasing.split_words(name) expected_list = EnglishPhrasing.list(expected) "#{english_name}#{expected_list}#{chained_method_clause_sentences}" end