Skip to content

Commit

Permalink
improved specs for disabling the wsdl
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiii committed Dec 20, 2009
1 parent fcca183 commit 015d35f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
38 changes: 24 additions & 14 deletions spec/savon/client_spec.rb
Expand Up @@ -28,17 +28,6 @@
@client.request.should be_a Savon::Request
end

it "has a getter for returning whether to use the Savon::WSDL (global setting)" do
@client.wsdl?.should be_true

Savon::Client.wsdl = false
@client.wsdl?.should be_false
Savon::Client.wsdl = true

@client.wsdl = false
@client.wsdl?.should be_false
end

it "responds to SOAP actions while still behaving as usual otherwise" do
WSDLFixture.authentication(:operations).keys.each do |soap_action|
@client.respond_to?(soap_action).should be_true
Expand All @@ -52,9 +41,30 @@
@client.authenticate.should be_a Savon::Response
end

it "dispatches SOAP calls via method_missing without using WSDL" do
@client.wsdl = false
@client.authenticate.should be_a Savon::Response
describe "disabling retrieving and parsing the WSDL document" do
it "can be done globally for every instance of Savon::Client" do
@client.wsdl?.should be_true
Savon::Client.wsdl = false

expect_the_wsdl_to_be_disabled
@client.authenticate.should be_a Savon::Response

Savon::Client.wsdl = true
end

it "can be done per request" do
@client.wsdl = false

expect_the_wsdl_to_be_disabled
@client.authenticate.should be_a Savon::Response
end

def expect_the_wsdl_to_be_disabled
@client.wsdl?.should be_false
[:respond_to?, :operations, :namespace_uri].each do |method|
Savon::WSDL.any_instance.expects(method).never
end
end
end

it "raises a Savon::SOAPFault in case of a SOAP fault" do
Expand Down
8 changes: 4 additions & 4 deletions spec/savon/core_ext/hash_spec.rb
Expand Up @@ -80,11 +80,11 @@ def singleton.to_datetime
end

it "calls to_s on Strings even if they respond to to_datetime" do
singleton = "gorilla"
singleton.expects( :to_s ).returns singleton
singleton.expects( :to_datetime ).never
object = "gorilla"
object.expects(:to_s).returns object
object.expects(:to_datetime).never

{ :name => singleton }.to_soap_xml.should == "<name>gorilla</name>"
{ :name => object }.to_soap_xml.should == "<name>gorilla</name>"
end

it "call to_s on any other Object" do
Expand Down

0 comments on commit 015d35f

Please sign in to comment.