Sha256: 1514d460d9f0d78806c87fb3c22740d069aa654ef739ea04998f419911762b3b

Contents?: true

Size: 1.25 KB

Versions: 31

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

class FakeBankAccount < BankAccount
  include CatarsePagarme::BankAccountConcern
end

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

  let(:valid_attr) do
    vb = build(:bank_account, bank: bank, owner_name: 'fo', user: user)
    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_truthy
      end

      it "bank_account_on_pagarme should be not valid with these attrs" do
        expect(bank_account_on_pagarme.valid?).to be_falsey
      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_truthy
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
catarse_pagarme-3.0.1 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-3.0.0 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.16.3 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.16.2 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.16.1 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.16.0 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.15.0 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.14.14 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.14.13 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.14.12 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.14.11 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.14.10 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.14.9 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.14.8 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.14.7 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.14.6 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.14.5 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.14.4 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.14.3 spec/models/catarse_pagarme/bank_account_concern_spec.rb
catarse_pagarme-2.14.2 spec/models/catarse_pagarme/bank_account_concern_spec.rb