lib/soaspec/matchers.rb in soaspec-0.2.4 vs lib/soaspec/matchers.rb in soaspec-0.2.5
- old
+ new
@@ -31,11 +31,13 @@
exchange = object.respond_to?(:exchange) ? object.exchange : object
expect { exchange[xpath] }.to_not raise_error # Error will be raised if Path returns no value
end
# TODO: Would be better to print failure message
- failure_message do |actual|
- "expected that #{actual.exchange_handler.response_body(actual.response, format: :raw)} would have element at path '#{xpath}'"
+ failure_message do |object|
+ # Object like `response` returns the Exchange object from which a path can be obtained
+ exchange = object.respond_to?(:exchange) ? object.exchange : object
+ "expected that #{exchange.exchange_handler.response_body(exchange.response, format: :raw)} would have element at path '#{xpath}'"
end
end
RSpec::Matchers.alias_matcher :have_element_at_xpath, :have_element_at_path
RSpec::Matchers.alias_matcher :contain_key, :have_element_at_path