Sha256: 607fe4efdd30c6954f150cb384dbaf4d1c4b84d696f6571e58a19191c78229ba

Contents?: true

Size: 1.54 KB

Versions: 54

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'

describe CatarsePagarme::ApplicationHelper, type: :helper 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(:payment) { create(:payment, value: 100) }

  context "#installments_for_select" do
    subject { installments_for_select(payment) }
    it { expect(subject.size).to eq(3) }
    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

54 entries across 54 versions & 1 rubygems

Version Path
catarse_pagarme-2.14.1 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.14.0 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.13.0 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.12.0 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.11.0 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.15 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.14 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.13 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.12 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.11 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.10 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.9 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.8 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.7 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.6 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.5 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.4 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.2 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.1 spec/helpers/catarse_pagarme/application_helper_spec.rb
catarse_pagarme-2.10.0 spec/helpers/catarse_pagarme/application_helper_spec.rb