Sha256: 96291221ad0d73ed5b3510f5a2292cddb047ec4f2aea9daa0460d2f3e9b9dda1

Contents?: true

Size: 1.48 KB

Versions: 11

Compression:

Stored size: 1.48 KB

Contents

require 'test_helper'

class Kaui::RefundsControllerTest < Kaui::FunctionalTestHelper

  test 'should create refunds' do
    get :new, :account_id => @account.account_id, :invoice_id => @paid_invoice_item.invoice_id, :payment_id => @payment.payment_id
    assert_response 200
    assert_not_nil assigns(:account)
    assert_not_nil assigns(:invoice)
    assert_not_nil assigns(:payment)

    refund_amount = @payment.purchased_amount.to_f / 3.0

    # Create three refunds
    # TODO test responses

    post :create,
         :account_id      => @account.account_id,
         :invoice_id      => @paid_invoice_item.invoice_id,
         :payment_id      => @payment.payment_id,
         :amount          => refund_amount,
         :adjustment_type => 'noInvoiceAdjustment'
    assert_response 302

    post :create,
         :account_id      => @account.account_id,
         :invoice_id      => @paid_invoice_item.invoice_id,
         :payment_id      => @payment.payment_id,
         :amount          => refund_amount,
         :adjustment_type => 'invoiceAdjustment'
    assert_response 302

    post :create,
         :account_id      => @account.account_id,
         :invoice_id      => @paid_invoice_item.invoice_id,
         :payment_id      => @payment.payment_id,
         :amount          => refund_amount,
         :adjustment_type => 'invoiceItemAdjustment',
         :adjustments     => {
             @paid_invoice_item.invoice_item_id => refund_amount
         }
    assert_response 302
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kaui-0.11.0 test/functional/kaui/refunds_controller_test.rb
kaui-0.10.0 test/functional/kaui/refunds_controller_test.rb
kaui-0.9.0 test/functional/kaui/refunds_controller_test.rb
kaui-0.8.4 test/functional/kaui/refunds_controller_test.rb
kaui-0.8.3 test/functional/kaui/refunds_controller_test.rb
kaui-0.8.2 test/functional/kaui/refunds_controller_test.rb
kaui-0.8.1 test/functional/kaui/refunds_controller_test.rb
kaui-0.8.0 test/functional/kaui/refunds_controller_test.rb
kaui-0.7.2 test/functional/kaui/refunds_controller_test.rb
kaui-0.7.1 test/functional/kaui/refunds_controller_test.rb
kaui-0.7.0 test/functional/kaui/refunds_controller_test.rb