class Representable::Matchers::ClassNameMatcher

Public Instance Methods

description() click to toggle source
# File lib/matchers/class_name_matcher.rb, line 11
def description
  "only allow representable property of a specific class"
end
failure_message_for_should() click to toggle source
# File lib/matchers/class_name_matcher.rb, line 15
def failure_message_for_should
  "Expected #{expectation}"
end
failure_message_for_should_not() click to toggle source
# File lib/matchers/class_name_matcher.rb, line 19
def failure_message_for_should_not
  "Did not expect #{expectation}"
end
matches?(subject) click to toggle source
# File lib/matchers/class_name_matcher.rb, line 6
def matches?(subject)
  @subject = subject
  matches_class?
end

Private Instance Methods

expectation() click to toggle source
# File lib/matchers/class_name_matcher.rb, line 29
def expectation
  "#{@subject.class} to be a kind of #{class_name}"
end
matches_class?() click to toggle source
# File lib/matchers/class_name_matcher.rb, line 25
def matches_class?
  @subject.send(:representable_attrs)[property].options[:class].to_s == class_name
end