lib/soaspec/matchers.rb in soaspec-0.0.34 vs lib/soaspec/matchers.rb in soaspec-0.0.35
- old
+ new
@@ -20,11 +20,11 @@
match do |actual|
expect(actual.api_class.include_in_body?(actual.response, expected)).to be true
end
failure_message do |actual|
- "expected that #{actual.api_class.response_body(actual.response, format: :xml)} would contain value #{expected}"
+ "expected that #{actual.api_class.response_body(actual.response, format: :raw)} would contain value #{expected}"
end
end
# Whether expected element exists in body
RSpec::Matchers.define :contain_key do |expected|
@@ -42,12 +42,14 @@
match do |exchange|
expect { exchange[xpath] }.to_not raise_error # Error will be raised if XPath returns no value
end
failure_message do |actual|
- "expected that #{actual.api_class.response_body(actual.response, format: :xml)} would have element at xpath '#{xpath}'"
+ "expected that #{actual.api_class.response_body(actual.response, format: :raw)} would have element at xpath '#{xpath}'"
end
end
+
+RSpec::Matchers.alias_matcher :have_element_at_path, :have_element_at_xpath
# Whether an element at xpath (defined by key) has value (defined by value).
# @param [Hash] expected_hash Xpath => Value pair (e.g. '//xmlns:GetWeatherResult' => 'Data Not Found')
RSpec::Matchers.define :have_xpath_value do |expected_hash|
match do |exchange|
\ No newline at end of file