Class: ProtobufSpec::Matchers::HaveProtobufPath

Inherits:
Object
  • Object
show all
Defined in:
lib/protobuf_spec/matchers/have_protobuf_path.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ HaveProtobufPath



5
6
7
8
# File 'lib/protobuf_spec/matchers/have_protobuf_path.rb', line 5

def initialize path
  @path = path
  @json_matcher = JsonSpec::Matchers::HaveJsonPath.new path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



4
5
6
# File 'lib/protobuf_spec/matchers/have_protobuf_path.rb', line 4

def path
  @path
end

Instance Method Details

#descriptionObject



22
23
24
# File 'lib/protobuf_spec/matchers/have_protobuf_path.rb', line 22

def description
  %(have Protobuf path "#{@path}")
end

#failure_message_for_shouldObject



14
15
16
# File 'lib/protobuf_spec/matchers/have_protobuf_path.rb', line 14

def failure_message_for_should
  %(Expected Protobuf path "#{@path}")
end

#failure_message_for_should_notObject



18
19
20
# File 'lib/protobuf_spec/matchers/have_protobuf_path.rb', line 18

def failure_message_for_should_not
  %(Expected no Protobuf path "#{@path}")
end

#matches?(proto) ⇒ Boolean



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

def matches? proto
  @json_matcher.matches? proto.to_json
end