lib/soaspec/matchers.rb in soaspec-0.0.72 vs lib/soaspec/matchers.rb in soaspec-0.0.73
- old
+ new
@@ -3,26 +3,26 @@
require_relative 'not_found_errors'
# Whether response has any element with the provided value
RSpec::Matchers.define :contain_value do |expected|
match do |actual|
- expect(actual.api_class.include_value?(actual.response, expected)).to be true
+ expect(actual.exchange_handler.include_value?(actual.response, expected)).to be true
end
failure_message do |actual|
- "expected that #{actual.api_class.response_body(actual.response, format: :hash)} would contain value #{expected}"
+ "expected that #{actual.exchange_handler.response_body(actual.response, format: :hash)} would contain value #{expected}"
end
end
# Whether substring exists in body of response (more general than above)
RSpec::Matchers.define :include_in_body do |expected|
match do |actual|
- expect(actual.api_class.include_in_body?(actual.response, expected)).to be true
+ expect(actual.exchange_handler.include_in_body?(actual.response, expected)).to be true
end
failure_message do |actual|
- "expected that #{actual.api_class.response_body(actual.response, format: :raw)} would contain value #{expected}"
+ "expected that #{actual.exchange_handler.response_body(actual.response, format: :raw)} would contain value #{expected}"
end
end
# Whether an element exists at expected xpath
RSpec::Matchers.define :have_element_at_path do |xpath|
@@ -30,11 +30,11 @@
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.api_class.response_body(actual.response, format: :raw)} would have element at path '#{xpath}'"
+ "expected that #{actual.exchange_handler.response_body(actual.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
@@ -54,10 +54,10 @@
end
RSpec::Matchers.define :be_found do
match do |exchange|
- expect(exchange.api_class.found?(exchange.response)).to be true
+ expect(exchange.exchange_handler.found?(exchange.response)).to be true
end
failure_message do |exchange|
"expected result #{exchange.response} to be found. Status code is #{exchange.response.code}"
end
\ No newline at end of file