Skip to content

Instantly share code, notes, and snippets.

@davetapley
Created July 17, 2012 06:24
Show Gist options
  • Save davetapley/3127578 to your computer and use it in GitHub Desktop.
Save davetapley/3127578 to your computer and use it in GitHub Desktop.
Rspec showing savon_spec is unable to work with a class which extends Savon::Model
require 'rspec'
require 'savon_spec'
RSpec.configure do |config|
config.include Savon::Spec::Macros
end
describe 'with client' do
let(:client) do
Savon::Client.new do
wsdl.endpoint = "http://service.example.com"
wsdl.namespace = "http://users.service.example.com"
end
end
before do
savon.expects(:get_user)
end
it 'mocks a SOAP request' do
client.request(:get_user)
end
end
class ExtendsSavonModel
extend Savon::Model
document "http://service.example.com?wsdl"
def self.get_user_class
client.request(:get_user)
end
def get_user_instance
client.request(:get_user)
end
end
describe 'with model' do
before do
savon.expects(:get_user)
end
it 'mocks a SOAP request for an instance method' do
ExtendsSavonModel.get_user_class
end
it 'mocks a SOAP request for an class method' do
ExtendsSavonModel.new.get_user_instance
end
end
@murdoch
Copy link

murdoch commented Aug 5, 2015

Did you ever figure out how to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment