Skip to content

Commit

Permalink
adds never
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjachmann committed Feb 8, 2011
1 parent 75d8b60 commit a6c7008
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/savon/spec/mock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ def with(soap_body)
self
end

def never
httpi_mock.never
self
end

# Sets up HTTPI to return a given +response+.
def returns(response = nil)
http = { :code => 200, :headers => {}, :body => "" }
Expand Down
15 changes: 14 additions & 1 deletion spec/savon/spec/mock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,20 @@
Mocha::ExpectationError,
/expected exactly once, not yet invoked: #<AnyInstance:Savon::SOAP::XML>.body=\(:id => 1\)/
)


teardown_mocks_for_rspec
end
end

describe "#expects and #never" do
before { savon.expects(:noop).never }

it "should not expect Savon to send a given SOAP body" do
expect { client.request(:noop) }.to raise_error(
Mocha::ExpectationError,
/expected never, invoked once: HTTPI.post()/
)

teardown_mocks_for_rspec
end
end
Expand Down

0 comments on commit a6c7008

Please sign in to comment.