Class: Smartest::BeAKindOfMatcher
- Inherits:
-
Object
- Object
- Smartest::BeAKindOfMatcher
- Defined in:
- lib/smartest/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(expected_class) ⇒ BeAKindOfMatcher
constructor
A new instance of BeAKindOfMatcher.
- #matches?(actual) ⇒ Boolean
- #negated_failure_message ⇒ Object
Constructor Details
#initialize(expected_class) ⇒ BeAKindOfMatcher
Returns a new instance of BeAKindOfMatcher.
172 173 174 |
# File 'lib/smartest/matchers.rb', line 172 def initialize(expected_class) @expected_class = expected_class end |
Instance Method Details
#description ⇒ Object
191 192 193 |
# File 'lib/smartest/matchers.rb', line 191 def description "be a kind of #{expected_description}" end |
#failure_message ⇒ Object
183 184 185 |
# File 'lib/smartest/matchers.rb', line 183 def "expected #{@actual.inspect} to be a kind of #{expected_description}, but was #{actual_class_description}" end |
#matches?(actual) ⇒ Boolean
176 177 178 179 180 181 |
# File 'lib/smartest/matchers.rb', line 176 def matches?(actual) @actual = actual actual.is_a?(@expected_class) rescue TypeError false end |
#negated_failure_message ⇒ Object
187 188 189 |
# File 'lib/smartest/matchers.rb', line 187 def "expected #{@actual.inspect} not to be a kind of #{expected_description}, but was #{actual_class_description}" end |