Class: Crspec::Matchers::BeAnInstanceOfMatcher

Inherits:
BaseMatcher
  • Object
show all
Defined in:
lib/crspec/matchers.rb

Instance Attribute Summary

Attributes inherited from BaseMatcher

#actual, #expected

Instance Method Summary collapse

Methods inherited from BaseMatcher

#and, #initialize, #or

Constructor Details

This class inherits a constructor from Crspec::Matchers::BaseMatcher

Instance Method Details

#failure_messageObject



161
162
163
# File 'lib/crspec/matchers.rb', line 161

def failure_message
  "Expected #{@actual.inspect} to be an instance of #{@expected}, but was #{@actual.class}"
end

#failure_message_when_negatedObject



165
166
167
# File 'lib/crspec/matchers.rb', line 165

def failure_message_when_negated
  "Expected #{@actual.inspect} not to be an instance of #{@expected}"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


156
157
158
159
# File 'lib/crspec/matchers.rb', line 156

def matches?(actual)
  @actual = actual
  @actual.instance_of?(@expected)
end