Class: Crspec::Matchers::BaseMatcher
- Inherits:
-
Object
- Object
- Crspec::Matchers::BaseMatcher
- Defined in:
- lib/crspec/matchers.rb
Direct Known Subclasses
AllMatcher, BeAKindOfMatcher, BeAnInstanceOfMatcher, BeFalsyMatcher, BeMatcher, BeNilMatcher, BeTruthyMatcher, BeWithinMatcher, ChangeMatcher, CustomMatcher, EndWithMatcher, EqMatcher, HaveAttributesMatcher, HaveHttpStatusMatcher, IncludeMatcher, MatchArrayMatcher, MatchMatcher, OutputMatcher, PredicateMatcher, RaiseErrorMatcher, RespondToMatcher, SatisfyMatcher, StartWithMatcher, YieldControlMatcher, YieldSuccessiveArgsMatcher, YieldWithArgsMatcher
Instance Attribute Summary collapse
-
#actual ⇒ Object
readonly
Returns the value of attribute actual.
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
Instance Method Summary collapse
- #and(other) ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(expected = nil) ⇒ BaseMatcher
constructor
A new instance of BaseMatcher.
- #or(other) ⇒ Object
Constructor Details
#initialize(expected = nil) ⇒ BaseMatcher
Returns a new instance of BaseMatcher.
8 9 10 |
# File 'lib/crspec/matchers.rb', line 8 def initialize(expected = nil) @expected = expected end |
Instance Attribute Details
#actual ⇒ Object (readonly)
Returns the value of attribute actual.
6 7 8 |
# File 'lib/crspec/matchers.rb', line 6 def actual @actual end |
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
6 7 8 |
# File 'lib/crspec/matchers.rb', line 6 def expected @expected end |
Instance Method Details
#and(other) ⇒ Object
20 21 22 |
# File 'lib/crspec/matchers.rb', line 20 def and(other) CompoundAndMatcher.new(self, other) end |
#failure_message ⇒ Object
12 13 14 |
# File 'lib/crspec/matchers.rb', line 12 def "Expected #{@actual.inspect} to match #{@expected.inspect}" end |
#failure_message_when_negated ⇒ Object
16 17 18 |
# File 'lib/crspec/matchers.rb', line 16 def "Expected #{@actual.inspect} not to match #{@expected.inspect}" end |
#or(other) ⇒ Object
24 25 26 |
# File 'lib/crspec/matchers.rb', line 24 def or(other) CompoundOrMatcher.new(self, other) end |