spec/sem4r/campaign/campaign_service_spec.rb in sem4r-0.1.1 vs spec/sem4r/campaign/campaign_service_spec.rb in sem4r-0.1.2
- old
+ new
@@ -1,5 +1,6 @@
+# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,47 +21,47 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# -------------------------------------------------------------------------
-require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
+require File.expand_path(File.dirname(__FILE__) + '/../../rspec_helper')
describe CampaignService do
include Sem4rSpecHelper
before do
@credentials = stub_credentials
end
it "should define 'all'" do
- response_xml = read_xml_file("services", "campaign", "get-res.xml")
+ response_xml = read_xml("campaign", "get-res.xml")
connector = mock("connector")
connector.should_receive(:send).and_return(response_xml)
service = CampaignService.new(connector)
soap_message = service.all( @credentials )
- els = REXML::XPath.match( soap_message.response, "//getResponse")
+ els = soap_message.response.xpath("//getResponse")
els.should_not be_empty
end
it "should define 'create'" do
@credentials.should_receive(:mutable?).and_return(true)
- response_xml = read_xml_file("services", "campaign", "mutate_add-res.xml")
+ response_xml = read_xml("campaign", "mutate_add-res.xml")
connector = mock("connector")
connector.should_receive(:send).and_return(response_xml)
service = CampaignService.new(connector)
soap_message = service.create( @credentials, "xml" )
- els = REXML::XPath.match( soap_message.response, "//mutateResponse")
+ els = soap_message.response.xpath("//mutateResponse")
els.should_not be_empty
end
it "should define 'delete'" do
@credentials.should_receive(:mutable?).and_return(true)
- response_xml = read_xml_file("services", "campaign", "mutate_add-res.xml")
+ response_xml = read_xml("campaign", "mutate_add-res.xml")
connector = mock("connector")
connector.should_receive(:send).and_return(response_xml)
service = CampaignService.new(connector)
soap_message = service.delete( @credentials, "xml" )
- els = REXML::XPath.match( soap_message.response, "//mutateResponse")
+ els = soap_message.response.xpath("//mutateResponse")
els.should_not be_empty
end
end