spec/public/client_spec.rb in pp-adaptive-0.0.5 vs spec/public/client_spec.rb in pp-adaptive-0.0.6

- old
+ new

@@ -1,11 +1,11 @@ require "spec_helper" describe AdaptivePayments::Client do let(:rest_client) { double(:post => '{}').tap { |d| d.stub(:[] => d) } } - let(:request_class) { stub(:operation => :Refund, :build_response => nil) } - let(:request) { stub(:class => request_class, :to_json => '{}') } + let(:request_class) { double(:operation => :Refund, :build_response => nil) } + let(:request) { double(:class => request_class, :to_json => '{}') } let(:client) { AdaptivePayments::Client.new } before(:each) do RestClient::Resource.stub(:new).and_return(rest_client) end @@ -76,20 +76,20 @@ rest_client.should_receive(:[]).with("Preapproval") client.execute(request) end it "uses the request class to build a response" do - response = stub(:response) + response = double(:response) request_class.should_receive(:build_response).and_return(response) client.execute(request).should == response end it "allows passing a Symbol + Hash instead of a full request object" do client.execute(:Refund, {}).should be_a_kind_of(AdaptivePayments::RefundResponse) end it "yields the response object" do - response = stub(:response) + response = double(:response) request_class.should_receive(:build_response).and_return(response) ret_val = nil client.execute(request) { |r| ret_val = r } ret_val.should == response end