Class: BeKindOfMatcher
- Defined in:
- lib/extensions/mspec/mspec/matchers/be_kind_of.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(expected) ⇒ BeKindOfMatcher
constructor
A new instance of BeKindOfMatcher.
- #matches?(actual) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(expected) ⇒ BeKindOfMatcher
Returns a new instance of BeKindOfMatcher.
2 3 4 |
# File 'lib/extensions/mspec/mspec/matchers/be_kind_of.rb', line 2 def initialize(expected) @expected = expected end |
Instance Method Details
#failure_message ⇒ Object
11 12 13 |
# File 'lib/extensions/mspec/mspec/matchers/be_kind_of.rb', line 11 def ["Expected #{@actual.inspect} (#{@actual.class})", "to be kind of #{@expected}"] end |
#matches?(actual) ⇒ Boolean
6 7 8 9 |
# File 'lib/extensions/mspec/mspec/matchers/be_kind_of.rb', line 6 def matches?(actual) @actual = actual @actual.is_a?(@expected) end |
#negative_failure_message ⇒ Object
15 16 17 |
# File 'lib/extensions/mspec/mspec/matchers/be_kind_of.rb', line 15 def ["Expected #{@actual.inspect} (#{@actual.class})", "not to be kind of #{@expected}"] end |