Class: ProtobufSpec::Matchers::BeProtobufEql

Inherits:
Object
  • Object
show all
Includes:
JsonSpec::Messages
Defined in:
lib/protobuf_spec/matchers/be_protobuf_eql.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected_json = nil) ⇒ BeProtobufEql



10
11
12
# File 'lib/protobuf_spec/matchers/be_protobuf_eql.rb', line 10

def initialize(expected_json = nil)
  @json_matcher= JsonSpec::Matchers::BeJsonEql.new expected_json
end

Instance Attribute Details

#actualObject (readonly)

Returns the value of attribute actual.



8
9
10
# File 'lib/protobuf_spec/matchers/be_protobuf_eql.rb', line 8

def actual
  @actual
end

Instance Method Details

#at_path(path) ⇒ Object



14
15
16
17
18
# File 'lib/protobuf_spec/matchers/be_protobuf_eql.rb', line 14

def at_path(path)
  @path=path
  @json_matcher.at_path path
  self
end

#descriptionObject



32
33
34
# File 'lib/protobuf_spec/matchers/be_protobuf_eql.rb', line 32

def description
  message_with_path("equal Protobuf")
end

#failure_message_for_shouldObject



24
25
26
# File 'lib/protobuf_spec/matchers/be_protobuf_eql.rb', line 24

def failure_message_for_should
  message_with_path("Expected equivalent Protobuf")
end

#matches?(protobuf) ⇒ Boolean



20
21
22
# File 'lib/protobuf_spec/matchers/be_protobuf_eql.rb', line 20

def matches?(protobuf)
  @json_matcher.matches? protobuf.to_json
end

#negative_failure_messageObject



28
29
30
# File 'lib/protobuf_spec/matchers/be_protobuf_eql.rb', line 28

def negative_failure_message
  message_with_path("Expected inequivalent Protobuf")
end