lib/soaspec/matchers.rb in soaspec-0.0.21 vs lib/soaspec/matchers.rb in soaspec-0.0.22
- old
+ new
@@ -1,15 +1,27 @@
require_relative 'hash_methods'
require_relative 'xpath_not_found'
+# TODO: Mathcers are specific to SOAP. Make generic for REST and others by using actual.api_class
+
RSpec::Matchers.define :contain_value do |expected|
match do |actual|
expect(actual.response.body.include_value?(expected)).to be true
end
failure_message do |actual|
"expected that #{actual.response.body} would contain value #{expected}"
+ end
+end
+
+RSpec::Matchers.define :include_in_body do |expected|
+ match do |actual|
+ expect(actual.response.to_xml.to_s.include?(expected)).to be true
+ end
+
+ failure_message do |actual|
+ "expected that #{actual.response.body.to_xml} would contain value #{expected}"
end
end
RSpec::Matchers.define :contain_key do |expected|
match do |actual|
\ No newline at end of file