class RSpec::Matchers::AliasedMatcher
@api private
description read naturally.
‘include( be_within(0.1).of(3) )`, and have the corresponding
`include( a_value_within(0.1).of(3) )` rather than
matchers, so that you can use an expression like
of a matcher. This is intended for use when composing
using the provided block in order to support an alias
Decorator that wraps a matcher and overrides `description`
def description
- Api: - private
def description @description_block.call(super) end
def failure_message
- Api: - private
def failure_message @description_block.call(super) end
def failure_message_when_negated
- Api: - private
def failure_message_when_negated @description_block.call(super) end
def initialize(base_matcher, description_block)
def initialize(base_matcher, description_block) @description_block = description_block super(base_matcher) end
def method_missing(*)
so that our override can be applied when it is eventually
the returned value if it responds to `description`,
(e.g. `a_value_within(0.1).of(3)`), we need to wrap
Since many matchers provide a fluent interface
Forward messages on to the wrapped matcher.
def method_missing(*) return_val = super return return_val unless RSpec::Matchers.is_a_matcher?(return_val) self.class.new(return_val, @description_block) end