spec/lib/soap_object_spec.rb in soap-object-0.1 vs spec/lib/soap_object_spec.rb in soap-object-0.2
- old
+ new
@@ -5,10 +5,15 @@
wsdl 'http://blah.com'
proxy 'http://proxy.com:8080'
open_timeout 10
read_timeout 20
+ soap_header 'Token' => 'secret'
+ encoding 'UTF-16'
+ basic_auth 'steve', 'secret'
+ digest_auth 'digest', 'auth'
+ log_level :error
end
describe SoapObject do
let(:client) { double('client') }
@@ -19,26 +24,46 @@
before do
Savon.should_receive(:client).and_return(client)
end
it "should initialize the client using the wsdl" do
- subject.client_properties[:wsdl].should == 'http://blah.com'
+ subject.send(:client_properties)[:wsdl].should == 'http://blah.com'
end
it "should know when it is connected to service" do
subject.should be_connected
end
it "should allow one to setup a proxy" do
- subject.client_properties[:proxy].should == 'http://proxy.com:8080'
+ subject.send(:client_properties)[:proxy].should == 'http://proxy.com:8080'
end
it "should allow one to set an open timeout" do
- subject.client_properties[:open_timeout].should == 10
+ subject.send(:client_properties)[:open_timeout].should == 10
end
it "should allow one to set a read timeout" do
- subject.client_properties[:read_timeout].should == 20
+ subject.send(:client_properties)[:read_timeout].should == 20
+ end
+
+ it "should allow one to set a soap header" do
+ subject.send(:client_properties)[:soap_header].should == {'Token' => 'secret'}
+ end
+
+ it "should allow one to set the encoding" do
+ subject.send(:client_properties)[:encoding].should == 'UTF-16'
+ end
+
+ it "should allow one to use basic authentication" do
+ subject.send(:client_properties)[:basic_auth].should == ['steve', 'secret']
+ end
+
+ it "should allow one to use digest authentication" do
+ subject.send(:client_properties)[:digest_auth].should == ['digest', 'auth']
+ end
+
+ it "should allow one to set the log level" do
+ subject.send(:client_properties)[:log_level].should == :error
end
end
context "when calling methods on the service" do
before do