require 'spec_helper' include ActiveMerchant::Billing describe BillingTransaction do describe "remote requests" do before :each do @response = mock("response") @response.stub!(:success?).and_return true @response.stub!(:authorization).and_return "some reference" @gateway = mock("gateway") @billing_transaction = BillingTransaction.new @billing_transaction.gateway = @gateway end describe ".puchase" do before do @gateway.stub!(:purchase).and_return @response end it "should take processor response as message" do @response.stub!(:message).and_return "I'm a gateway response" @billing_transaction.purchase!(100, Factory.build(:credit_card)) @billing_transaction.message.should == "I'm a gateway response" end end describe ".credit" do before do @gateway.stub!(:credit).and_return @response end it "should take processor response as message" do @response.stub!(:message).and_return "I'm a gateway response" @billing_transaction.credit!(100, Factory.build(:credit_card)) @billing_transaction.message.should == "I'm a gateway response" end end end end