Class: Spec::Matchers::BeKindOf
- Defined in:
- lib/spec/matchers/be_kind_of.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(expected) ⇒ BeKindOf
constructor
A new instance of BeKindOf.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(expected) ⇒ BeKindOf
Returns a new instance of BeKindOf.
4 5 6 |
# File 'lib/spec/matchers/be_kind_of.rb', line 4 def initialize(expected) @expected = expected end |
Instance Method Details
#description ⇒ Object
13 14 15 |
# File 'lib/spec/matchers/be_kind_of.rb', line 13 def description "be a kind of #{@expected}" end |
#failure_message_for_should ⇒ Object
17 18 19 |
# File 'lib/spec/matchers/be_kind_of.rb', line 17 def "expected kind of #{@expected}, got #{@actual.inspect}" end |
#failure_message_for_should_not ⇒ Object
21 22 23 |
# File 'lib/spec/matchers/be_kind_of.rb', line 21 def "expected #{@actual.inspect} not to be a kind of #{@expected}" end |
#matches?(actual) ⇒ Boolean
8 9 10 11 |
# File 'lib/spec/matchers/be_kind_of.rb', line 8 def matches?(actual) @actual = actual @actual.kind_of?(@expected) end |