Created
April 20, 2012 20:09
-
-
Save hoverlover/2431481 to your computer and use it in GitHub Desktop.
Faking it with Savon. Returns a fake response instead of hitting the soap service.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "Faking it with Savon" do | |
before do | |
Savon.hooks.define "Fake Response", :soap_request do | |
HTTPI::Response.new(200, {}, "<Envelope><Body><response>Success!</response></Body></Envelope>") | |
end | |
after do | |
Savon.hooks.reject! "Fake Response" | |
end | |
let(:savon) do | |
client = Savon::Client.new do |wsdl, http| | |
wsdl.document = "http://service.example.com?wsdl" | |
end | |
end | |
subject { savon.request(:fake_action)[:response] } | |
it { should == "Success!" } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment