lib/soaspec/matchers.rb in soaspec-0.0.4 vs lib/soaspec/matchers.rb in soaspec-0.0.5
- old
+ new
@@ -1,5 +1,17 @@
RSpec::Matchers.define :contain do |expected|
match do |actual|
expect(actual.xml_response).to include expected
end
+end
+
+RSpec::Matchers.define :have_element_at_xpath do |expected|
+ match do |soap_class|
+ expect(soap_class.xml_doc.at_xpath(expected, Soaspec::Environment.api_handler.namespaces).content).not_to be_empty
+ end
+end
+
+RSpec::Matchers.define :have_xpath_value do |expected_hash|
+ match do |soap_class|
+ expect(soap_class.xml_doc.at_xpath(expected_hash.keys.first, Soaspec::Environment.api_handler.namespaces).content).to eq expected_hash.values.first
+ end
end
\ No newline at end of file