Sha256: 51eb77fceeec453ead992286afd21e810314fe64773f58058a2a6528745bbb47

Contents?: true

Size: 1021 Bytes

Versions: 3

Compression:

Stored size: 1021 Bytes

Contents

describe Akatus::Services::Installments do

  it "fetches dummy installment options for transactions that don't support installments" do

    p = Akatus::Payment.new
    p.items << build(:item)
    p.payment_method = Akatus::BoletoBancario.new

    result = Akatus::Services::Installments.calculate(p)

    result.description.should be_nil
    result.taken_installments.should == 0
    result.installments.size.should == 1

    installment = result.installments.first
    installment.quantity.should == 1
    installment.unitary_amount.should == p.total_amount
    installment.total_amount.should == p.total_amount

  end

  it "fetches installment options for transactions with credit card" do

    p = Akatus::Payment.new
    p.items << build(:item)
    p.payment_method = Akatus::CreditCard.new(:brand => 'cartao_visa')

    result = Akatus::Services::Installments.calculate(p)

    result.description.length.should be > 0
    result.taken_installments.should == 0
    result.installments.size.should >= 0

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
akatus-1.0.2 spec/services/installments_spec.rb
akatus-1.0.1 spec/services/installments_spec.rb
akatus-1.0.0 spec/services/installments_spec.rb