lib/soaspec/matchers.rb in soaspec-0.0.27 vs lib/soaspec/matchers.rb in soaspec-0.0.28
- old
+ new
@@ -8,10 +8,11 @@
RSpec::Matchers.define :contain_value do |expected|
match do |actual|
expect(actual.api_class.include_value?(actual.response, expected)).to be true
end
+ # TODO: Fix this for REST
failure_message do |actual|
"expected that #{actual.response.body} would contain value #{expected}"
end
end
@@ -19,10 +20,11 @@
RSpec::Matchers.define :include_in_body do |expected|
match do |actual|
expect(actual.api_class.include_in_body?(actual.response, expected)).to be true
end
+ # TODO: Fix this for REST
failure_message do |actual|
"expected that #{actual.response.body.to_xml} would contain value #{expected}"
end
end
@@ -56,8 +58,20 @@
expect(exchange[expected_hash.keys.first]).to eq expected_hash.values.first
end
failure_message do |actual|
"expected that xpath '#{expected_hash.keys.first}' has value '#{expected_hash.values.first}' but was '#{actual[expected_hash.keys.first]}'"
+ end
+
+end
+
+RSpec::Matchers.define :be_found do
+
+ match do |exchange|
+ expect(exchange.api_class.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
end
\ No newline at end of file