class DataMapper::Matchers::HaveProperty

Public Class Methods

new(property) click to toggle source
# File lib/dm/matchers/have_property.rb, line 5
def initialize(property)
  @property = property.to_sym
end

Public Instance Methods

description() click to toggle source
# File lib/dm/matchers/have_property.rb, line 22
def description
  "have property #{@property}"
end
failure_message() click to toggle source
# File lib/dm/matchers/have_property.rb, line 14
def failure_message
  "expected to have property #{@property}"
end
failure_message_when_negated() click to toggle source
# File lib/dm/matchers/have_property.rb, line 18
def failure_message_when_negated
  "expected to not have property #{@property}"
end
matches?(model) click to toggle source
# File lib/dm/matchers/have_property.rb, line 9
def matches?(model)
  model_class = model.is_a?(Class) ? model : model.class
  model_class.properties.map(&:name).include? @property
end