Skip to content

Instantly share code, notes, and snippets.

@windock
Created May 30, 2010 20:08
Show Gist options
  • Select an option

  • Save windock/419286 to your computer and use it in GitHub Desktop.

Select an option

Save windock/419286 to your computer and use it in GitHub Desktop.

Revisions

  1. windock created this gist May 30, 2010.
    43 changes: 43 additions & 0 deletions gistfile1.builder
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    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