Class: ProtobufSpec::Matchers::BeProtobufEql

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

Instance Method Summary collapse

Constructor Details

#initialize(expected_json = nil) ⇒ BeProtobufEql

Returns a new instance of BeProtobufEql.



12
13
14
# File 'lib/protobuf_spec/matchers/be_protobuf_eql.rb', line 12

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

Instance Method Details

#actualObject



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

def actual
  @json_matcher.actual
end

#at_path(path) ⇒ Object



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

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

#descriptionObject



42
43
44
# File 'lib/protobuf_spec/matchers/be_protobuf_eql.rb', line 42

def description
  message_with_path("equal Protobuf")
end

#diffable?Boolean

Returns:

  • (Boolean)


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

def diffable?
  true
end

#expectedObject



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

def expected
  @json_matcher.expected
end

#failure_message_for_shouldObject



34
35
36
# File 'lib/protobuf_spec/matchers/be_protobuf_eql.rb', line 34

def failure_message_for_should
  message_with_path("Expected equivalent Protobuf")
end

#matches?(protobuf) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/protobuf_spec/matchers/be_protobuf_eql.rb', line 30

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

#negative_failure_messageObject



38
39
40
# File 'lib/protobuf_spec/matchers/be_protobuf_eql.rb', line 38

def negative_failure_message
  message_with_path("Expected inequivalent Protobuf")
end