Sha256: 80f704cd4065a98e0bb677096c414c5c4acdf11098901adb6493c2696573d4c5

Contents?: true

Size: 1.46 KB

Versions: 13

Compression:

Stored size: 1.46 KB

Contents

require "spec_helper"

RSpec.describe Mundipagg::Boleto do
  describe "#payload" do
    let(:boleto) do
      described_class.new bank_number: 347,
        bank_code: 123456
    end

    it do
      expect(boleto.payload(100)).to eq({
        amount_in_cents: 100,
        currency_iso_enum: "BRL",
        boleto_transaction_collection: {
          boleto_transaction: {
            amount_in_cents: 100,
            bank_number: 347,
            days_to_add_in_boleto_expiration_date: 5,
            nosso_numero: 123456
          }
        }
      })
    end
  end
end

RSpec.describe Mundipagg::Boleto::Response do
  let(:body) do
    {
      create_order_response: {
        create_order_result: {
          error_report: {
            error_item_collection: {
              error_item: {
                description: "Out of Money",
                error_code: "E666"
              }
            }
          }
        }
      }
    }
  end

  let(:response) { described_class.new body }

  describe "#payload" do
    it do
      expect(response.payload).to eq({
        error_report: {
          error_item_collection: {
            error_item: {
              description: "Out of Money",
              error_code: "E666"
            }
          }
        }
      })
    end
  end

  describe "#error" do
    it { expect(response.error).to be_a(Mundipagg::Error) }
    it { expect(response.error.code).to eq("E666") }
    it { expect(response.error.message).to eq("Out of Money") }
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
better-mundipagg-0.2.7 spec/lib/mundipagg/boleto_spec.rb
better-mundipagg-0.2.6 spec/lib/mundipagg/boleto_spec.rb
better-mundipagg-0.2.5 spec/lib/mundipagg/boleto_spec.rb
better-mundipagg-0.2.4 spec/lib/mundipagg/boleto_spec.rb
better-mundipagg-0.2.3 spec/lib/mundipagg/boleto_spec.rb
better-mundipagg-0.2.2 spec/lib/mundipagg/boleto_spec.rb
better-mundipagg-0.2.1 spec/lib/mundipagg/boleto_spec.rb
better-mundipagg-0.2.0 spec/lib/mundipagg/boleto_spec.rb
better-mundipagg-0.1.5 spec/lib/mundipagg/boleto_spec.rb
better-mundipagg-0.1.3 spec/lib/mundipagg/boleto_spec.rb
better-mundipagg-0.1.2 spec/lib/mundipagg/boleto_spec.rb
better-mundipagg-0.1.1 spec/lib/mundipagg/boleto_spec.rb
better-mundipagg-0.1.0 spec/lib/mundipagg/boleto_spec.rb