Sha256: 140b9324b1a7a9afe49df5c67b1f4947cf6f73466ae0f61caeabf44210f5e10a

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'

describe CatarsePagarme::ApplicationHelper do
  before do
    installments_hash = {"installments"=>{"1"=>{"installment"=>1, "amount"=>10000, "installment_amount"=>10000}, "2"=>{"installment"=>2, "amount"=>10000, "installment_amount"=>5000}, "3"=>{"installment"=>3, "amount"=>10000, "installment_amount"=>3333}, "4"=>{"installment"=>4, "amount"=>10000, "installment_amount"=>2500}, "5"=>{"installment"=>5, "amount"=>10000, "installment_amount"=>2000}, "6"=>{"installment"=>6, "amount"=>10000, "installment_amount"=>1667}, "7"=>{"installment"=>7, "amount"=>10000, "installment_amount"=>1429}, "8"=>{"installment"=>8, "amount"=>10000, "installment_amount"=>1250}, "9"=>{"installment"=>9, "amount"=>10000, "installment_amount"=>1111}, "10"=>{"installment"=>10, "amount"=>10000, "installment_amount"=>1000}, "11"=>{"installment"=>11, "amount"=>10000, "installment_amount"=>909}, "12"=>{"installment"=>12, "amount"=>10000, "installment_amount"=>833}}}
    PagarMe::Transaction.stub(:calculate_installments).and_return(installments_hash)
    CatarsePagarme.configuration.stub(:max_installments).and_return(6)
  end

  let(:contribution) { create(:contribution, value: 100) }

  context "#installments_for_select" do
    subject { installments_for_select(contribution) }
    it { expect(subject.size).to eq(6) }
    it { expect(subject[0][0]).to eq('1x $100.00') }
    it { expect(subject[0][1]).to eq(1) }
  end

  context '#format_instalment_text' do
    subject { format_instalment_text(4, 100.0) }
    it { expect(subject).to eq('4x $100.00') }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
catarse_pagarme-0.1.1 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-0.1.0 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-0.0.2 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-0.0.1 spec/helpers/catarse_pagarme/application_helper_spec.rb