Sha256: 3d7bd530fbeddd21df660f26158db6a54c59278fc70a0605309555253ff9f055

Contents?: true

Size: 1.2 KB

Versions: 12

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

class FakeBankAccount < BankAccount
  include CatarsePagarme::BankAccountConcern
end

describe FakeBankAccount do
  let(:bank) { create(:bank) }

  let(:valid_attr) do
    vb = build(:bank_account, bank: bank, owner_name: 'fo')
    vb.attributes
  end

  let(:valid_attr_on_pagarme) do
    {
      bank_id: bank.id,
      agency: '1732',
      agency_dv: '8',
      account: '25483',
      account_dv: 'X',
      owner_name: 'Lorem Ipsum',
      owner_document: '111.111.111-11'
    }
  end

  describe "validate :must_be_valid_on_pagarme" do
    context "when bank account has invalid data on pagarme" do
      let(:bank_account_on_pagarme) { FakeBankAccount.new(valid_attr) }
      let(:local_bank_account) { BankAccount.new(valid_attr) }

      it "local_bank_account should be valid" do
        expect(local_bank_account.valid?).to be_true
      end

      it "bank_account_on_pagarme should be not valid with these attrs" do
        expect(bank_account_on_pagarme.valid?).to be_false
      end

      it "bank_account_on_pagarme should be valid with another attrs" do
        subject { FakeBankAccount.new(valid_attr_on_pagarme).valid? }
        expect(subject).to be_true
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
catarse_pagarme-2.7.11 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.7.10 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.7.9 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.7.8 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.7.7 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.7.6 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.7.5 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.7.4 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.7.3 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.7.2 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.7.1 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.7.0 spec/models/catarse_pagarme/bank_account_concern_spec.rb