Included Modules

Class Index [+]

Quicksearch

RSpec::Matchers::BuiltIn::BaseMatcher

@api private

Used internally as a base class for matchers that ship with rspec-expectations.

### Warning:

This class is for internal use, and subject to change without notice. We strongly recommend that you do not base your custom matchers on this class. If/when this changes, we will announce it and remove this warning.

Attributes

actual[R]
expected[R]
rescued_exception[R]

Public Class Methods

new(expected=nil) click to toggle source
    # File lib/rspec/matchers/built_in/base_matcher.rb, line 19
19:         def initialize(expected=nil)
20:           @expected = expected
21:         end

Public Instance Methods

==(other) click to toggle source
    # File lib/rspec/matchers/built_in/base_matcher.rb, line 53
53:         def ==(other)
54:           matches?(other)
55:         end
description() click to toggle source
    # File lib/rspec/matchers/built_in/base_matcher.rb, line 45
45:         def description
46:           expected ? "#{name_to_sentence} #{expected.inspect}" : name_to_sentence
47:         end
diffable?() click to toggle source
    # File lib/rspec/matchers/built_in/base_matcher.rb, line 49
49:         def diffable?
50:           false
51:         end
failure_message_for_should() click to toggle source
    # File lib/rspec/matchers/built_in/base_matcher.rb, line 37
37:         def failure_message_for_should
38:           "expected #{actual.inspect} to #{name_to_sentence}#{expected_to_sentence}"
39:         end
failure_message_for_should_not() click to toggle source
    # File lib/rspec/matchers/built_in/base_matcher.rb, line 41
41:         def failure_message_for_should_not
42:           "expected #{actual.inspect} not to #{name_to_sentence}#{expected_to_sentence}"
43:         end
match_unless_raises(*exceptions) click to toggle source
    # File lib/rspec/matchers/built_in/base_matcher.rb, line 27
27:         def match_unless_raises(*exceptions)
28:           exceptions.unshift Exception if exceptions.empty?
29:           begin
30:             yield
31:           rescue *exceptions => @rescued_exception
32:             return false
33:           end
34:           true
35:         end
matches?(actual) click to toggle source
    # File lib/rspec/matchers/built_in/base_matcher.rb, line 23
23:         def matches?(actual)
24:           @actual = actual
25:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.