Sha256: 8099b1441f13dcfa3a1496bb43f3f3113d86ee29a11fbac996a6b932b41c651e

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

require_relative '../../test_helper'

module PagarMe
  class BankAccountTest < PagarMeTestCase
    should 'be able to create a bank_account' do
      bank_account = PagarMe::BankAccount.create bank_account_params
      assert_equal bank_account.bank_code, '237'
    end

    should 'be able to search by anything' do
      PagarMe::BankAccount.create bank_account_params
      bank_accounts = PagarMe::BankAccount.find_by bank_code: '237'

      assert bank_accounts.size > 0
      bank_accounts.each do |bank_account|
        assert_equal bank_account.bank_code, '237'
      end
    end

    {
      bank_code:       '123',
      agencia:         '1234',
      agencia_dv:      '1',
      conta:           '4444',
      conta_dv:        '1',
      legal_name:      'John Doe',
      document_number: '02476585700'
    }.each do |key, value|
      should "validate bank_account - #{key}" do
        exception = assert_raises(PagarMe::ValidationError){ BankAccount.create key => value }
        assert_hasnt_error_param exception, key.to_s
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pagarme-2.4.0 test/pagarme/resources/bank_account_test.rb
pagarme-2.3.0 test/pagarme/resources/bank_account_test.rb
pagarme-2.2.3 test/pagarme/resources/bank_account_test.rb
pagarme-2.2.2 test/pagarme/resources/bank_account_test.rb
pagarme-2.2.1 test/pagarme/resources/bank_account_test.rb
pagarme-2.2.0 test/pagarme/resources/bank_account_test.rb
pagarme-2.1.4 test/pagarme/resources/bank_account_test.rb