module RSpec::Matchers::DSL::DefaultImplementations

Defines default implementations of the matcher protocol methods for custom matchers. You can override any of these using the {RSpec::Matchers::DSL::Macros Macros} methods from within an `RSpec::Matchers.define` block.

Public Instance Methods

description() click to toggle source

The default description.

# File lib/rspec/matchers/dsl.rb, line 302
def description
  "#{name_to_sentence}#{to_sentence expected}#{chained_method_clause_sentences}"
end
diffable?() click to toggle source

@api private Used internally by objects returns by `should` and `should_not`.

# File lib/rspec/matchers/dsl.rb, line 297
def diffable?
  false
end
expects_call_stack_jump?() click to toggle source

Most matchers do not expect call stack jumps.

# File lib/rspec/matchers/dsl.rb, line 313
def expects_call_stack_jump?
  false
end
supports_block_expectations?() click to toggle source

Matchers do not support block expectations by default. You must opt-in.

# File lib/rspec/matchers/dsl.rb, line 308
def supports_block_expectations?
  false
end

Private Instance Methods

chained_method_clause_sentences() click to toggle source
# File lib/rspec/matchers/dsl.rb, line 319
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)|
    " #{split_words(method_name)}#{to_sentence(method_args)}"
  end.join
end