Sha256: 6ce6298bddb79cc5fb248fa67fc43b8dcc04e90dab5a822a815aa1a909da5505

Contents?: true

Size: 1.38 KB

Versions: 4

Compression:

Stored size: 1.38 KB

Contents

require "spec_helper"

describe "#acts_as_credit_card_transactionable" do
  before(:each) { @user = User.create }

  specify { @user.class.should respond_to :acts_as_credit_card_transactionable }

  describe "#sync_customer", :vcr, :marketplace do
    before(:each) do 
      @user = User.create
      @user.sync_customer
      @user.reload
    end

    specify { @user.remote_customer.should_not be_blank }
    specify { @user.remote_customer.uri.should_not be_blank }
  end

  describe "#remote", :vcr, :marketplace do
    before(:each) do
      @user = User.create
      @user.sync_customer
      @user.reload
      @remote_customer = @user.remote_customer.fetch
    end

    specify { @user.remote.should be_instance_of Balanced::Customer }
    specify { @user.remote.attributes.should eql @remote_customer.attributes }
  end

  describe "#add_credit_card", :vcr, :marketplace do
    before(:each) do
      @user = User.create
      @balanced_card = Balanced::Card.new(
          card_number:      '4111111111111111',
          expiration_year:  (Date.today+2.years).year,
          expiration_month: '12').save
      @user.add_credit_card(@balanced_card.uri)
      @credit_card = @user.credit_cards.first
    end

    specify { @user.credit_cards.should_not be_blank }
    specify { @credit_card.remote_credit_card.uri.should_not be_blank }
    specify { @credit_card.last_four.should eql 1111 }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
transactionable-0.3.1 spec/integration/acts_as_credit_card_transactionable_spec.rb
transactionable-0.3.0 spec/integration/acts_as_credit_card_transactionable_spec.rb
transactionable-0.2.0 spec/integration/acts_as_credit_card_transactionable_spec.rb
transactionable-0.1.0 spec/integration/acts_as_credit_card_transactionable_spec.rb