class Pact::SomethingLike

Specifies that the actual object should be considered a match if it includes the same keys, and the values of the keys are of the same class.

Attributes

contents[R]

Public Class Methods

json_create(hash) click to toggle source
# File lib/pact/something_like.rb, line 31
def self.json_create hash
  new(symbolize_keys(hash)[:contents])
end
new(contents) click to toggle source
# File lib/pact/something_like.rb, line 12
def initialize contents
  @contents = contents
end

Public Instance Methods

==(other) click to toggle source
# File lib/pact/something_like.rb, line 39
def == other
  other.is_a?(SomethingLike) && other.contents == self.contents
end
as_json(opts = {}) click to toggle source
# File lib/pact/something_like.rb, line 23
def as_json opts = {}
  to_hash
end
eq(other) click to toggle source
# File lib/pact/something_like.rb, line 35
def eq other
  self == other
end
generate() click to toggle source
# File lib/pact/something_like.rb, line 43
def generate
  contents
end
to_hash() click to toggle source
# File lib/pact/something_like.rb, line 16
def to_hash
  {
    :json_class => self.class.name,
    :contents => contents
  }
end
to_json(opts = {}) click to toggle source
# File lib/pact/something_like.rb, line 27
def to_json opts = {}
  as_json.to_json opts
end