Sha256: ce0a0dc98a712d38ec4e01613bdec7ce6e94210e7bcf10c95dc0cbeb3fb445b9

Contents?: true

Size: 1009 Bytes

Versions: 2

Compression:

Stored size: 1009 Bytes

Contents

require_relative '../../test_helper'

module PagarMe
  class PayableTest < Test::Unit::TestCase
    should 'be created setting default recipient on payable' do
      transaction = PagarMe::Transaction.create transaction_with_customer_with_card_params
      payable     = transaction.payables.first

      assert_equal transaction.payables.count, 1
      assert_equal payable.recipient_id, PagarMe::Recipient.default.id
    end

    should 'create one per split rule' do
      transaction = PagarMe::Transaction.create transaction_with_customer_with_card_with_split_rules_params
      payable     = transaction.payables.first

      assert_equal transaction.payables.count, 4
      assert_equal transaction.payables.map(&:recipient_id).sort, fixtures.persistent_recipient_ids.sort
    end

    should 'be found' do
      payables = PagarMe::Payable.find_by type: 'refund'

      assert payables.count > 0
      payables.each do |payable|
        assert_equal payable.type, 'refund'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pagarme-2.1.2 test/pagarme/resources/payable_test.rb
pagarme-2.1.1 test/pagarme/resources/payable_test.rb