Sha256: 6a13f82238fab4e0a46e2933f43258fc5c18852d562ef6c55fe901748827c76b

Contents?: true

Size: 1.57 KB

Versions: 14

Compression:

Stored size: 1.57 KB

Contents

require 'test_helper'

class Kaui::ChargebacksControllerTest < Kaui::FunctionalTestHelper

  test 'should handle Kill Bill errors in new screen' do
    payment_id = SecureRandom.uuid.to_s
    get :new, :account_id => @account.account_id, :payment_id => payment_id
    assert_redirected_to account_path(@account.account_id)
    assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{payment_id} type=PAYMENT doesn't exist!", flash[:error]
  end

  test 'should get new' do
    get :new, :account_id => @account.account_id, :payment_id => @payment.payment_id
    assert_response 200
  end

  test 'should handle Kill Bill errors during create' do
    payment_id = SecureRandom.uuid.to_s
    post :create,
         :account_id => @account.account_id,
         :chargeback => {
             :payment_id => payment_id,
             :amount => @payment.paid_amount_to_money.to_f,
             :currency => @payment.currency
         }
    assert_template :new
    assert_equal "Error while creating a new chargeback: Error 404: Object id=#{payment_id} type=PAYMENT doesn't exist!", flash[:error]
  end

  test 'should create chargeback' do
    post :create,
         :account_id => @payment.account_id,
         :chargeback => {
             :payment_id => @payment.payment_id,
             :amount => @payment.paid_amount_to_money.to_f,
             :currency => @payment.currency
         },
         :cancel_all_subs => '1'
    assert_redirected_to account_payment_path(@payment.account_id, @payment.payment_id)
    assert_equal 'Chargeback created', flash[:notice]
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
kaui-2.0.4 test/functional/kaui/chargebacks_controller_test.rb
kaui-2.0.3 test/functional/kaui/chargebacks_controller_test.rb
kaui-2.0.2 test/functional/kaui/chargebacks_controller_test.rb
kaui-2.0.1 test/functional/kaui/chargebacks_controller_test.rb
kaui-2.0.0 test/functional/kaui/chargebacks_controller_test.rb
kaui-1.4.1 test/functional/kaui/chargebacks_controller_test.rb
kaui-1.4.0 test/functional/kaui/chargebacks_controller_test.rb
kaui-1.3.0 test/functional/kaui/chargebacks_controller_test.rb
kaui-1.2.0 test/functional/kaui/chargebacks_controller_test.rb
kaui-1.1.0 test/functional/kaui/chargebacks_controller_test.rb
kaui-1.0.0 test/functional/kaui/chargebacks_controller_test.rb
kaui-0.16.2 test/functional/kaui/chargebacks_controller_test.rb
kaui-0.16.1 test/functional/kaui/chargebacks_controller_test.rb
kaui-0.16.0 test/functional/kaui/chargebacks_controller_test.rb