Exception: Restspec::Schema::Checker::DifferentTypeError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/restspec/schema/checker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, attribute) ⇒ DifferentTypeError

Returns a new instance of DifferentTypeError.



49
50
51
52
53
# File 'lib/restspec/schema/checker.rb', line 49

def initialize(object, attribute)
  self.object = object
  self.attribute = attribute
  self.value = object.fetch(attribute.name)
end

Instance Attribute Details

#attributeObject

Returns the value of attribute attribute.



47
48
49
# File 'lib/restspec/schema/checker.rb', line 47

def attribute
  @attribute
end

#objectObject

Returns the value of attribute object.



47
48
49
# File 'lib/restspec/schema/checker.rb', line 47

def object
  @object
end

#valueObject

Returns the value of attribute value.



47
48
49
# File 'lib/restspec/schema/checker.rb', line 47

def value
  @value
end

Instance Method Details

#to_sObject



55
56
57
# File 'lib/restspec/schema/checker.rb', line 55

def to_s
  "The property #{attribute.name} of #{object} should be of type #{attribute.type} but it was of type #{value.class}"
end