Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec failures with savon >= 0.9.3 #2

Closed
lgustafson opened this issue Jul 21, 2011 · 2 comments
Closed

Spec failures with savon >= 0.9.3 #2

lgustafson opened this issue Jul 21, 2011 · 2 comments

Comments

@lgustafson
Copy link

With the latest savon (currently 0.9.6), savon_spec no longer works properly. Here is the output for "rspec spec":

Failures:

  1) Savon::Spec::Mock#expects and #with should expect Savon to send a given SOAP body
     Failure/Error: client.request :get_user do
     Mocha::ExpectationError:
       unexpected invocation: #<AnyInstance:Savon::SOAP::XML>.body=(nil)
       unsatisfied expectations:
       - expected exactly once, not yet invoked: HTTPI.post()
       - expected exactly once, not yet invoked: #<AnyInstance:Savon::SOAP::XML>.body=(:id => 1)
     # ./spec/savon/spec/mock_spec.rb:47

  2) Savon::Spec::Mock#expects and #with should fail when the SOAP body was not send
     Failure/Error: client.request(:get_user)
     Mocha::ExpectationError:
       unexpected invocation: #<AnyInstance:Savon::SOAP::XML>.body=(nil)
       unsatisfied expectations:
       - expected exactly once, not yet invoked: HTTPI.post()
       - expected exactly once, not yet invoked: #<AnyInstance:Savon::SOAP::XML>.body=(:id => 1)
     # ./spec/savon/spec/mock_spec.rb:53

Finished in 0.03766 seconds
29 examples, 2 failures

Failed examples:

rspec ./spec/savon/spec/mock_spec.rb:46 # Savon::Spec::Mock#expects and #with should expect Savon to send a given SOAP body
rspec ./spec/savon/spec/mock_spec.rb:52 # Savon::Spec::Mock#expects and #with should fail when the SOAP body was not send
@lgustafson
Copy link
Author

This may be caused by a change in Savon::Client#preconfigure. An rspec backtrace of savon_spec indicates the problem is on line 113 of lib/savon/client.rb. Here is the line in savon 0.9.6:

soap.body = args[2].delete(:body)

On savon 0.9.2, here is the same line (line 116):

soap.body = options[2].delete(:body) if options[2][:body]

Note that in the old version body is only set if the options[2][:body] evaluates to true. I think removing this conditional breaks savon_spec. Note that the specs in savon_spec succeed when line 113 is changed like this:

soap.body = args[2].delete(:body) if args[2][:body]

@rubiii
Copy link
Contributor

rubiii commented Aug 25, 2011

this should be fixed by upgrading to the new savon v0.9.7. please let me know if it works for you.

@rubiii rubiii closed this as completed Aug 25, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants