Sha256: 16b1552b732ff829453294b0d0fd8a806c2324d854fef517e34c269631f94342

Contents?: true

Size: 1.43 KB

Versions: 6

Compression:

Stored size: 1.43 KB

Contents

require 'test_helper'

class Kaui::PaymentsControllerTest < Kaui::FunctionalTestHelper

  test 'should get index' do
    get :index, :account_id => @invoice_item.account_id
    assert_response 200
  end

  test 'should list payments' do
    # Test pagination
    get :pagination, :format => :json
    verify_pagination_results!
  end

  test 'should search payments' do
    # Test search
    get :pagination, :search => {:search => 'foo'}, :format => :json
    verify_pagination_results!
  end

  test 'should create payments' do
    # Verify we can pre-populate the payment
    get :new, :account_id => @invoice_item.account_id, :invoice_id => @invoice_item.invoice_id
    assert_response 200
    assert_not_nil assigns(:payment)

    # Create the payment
    post :create, :account_id => @invoice_item.account_id, :invoice_payment => {:account_id => @invoice_item.account_id, :target_invoice_id => @invoice_item.invoice_id, :purchased_amount => 10}, :external => 1
    assert_response 302

    # Test pagination
    get :pagination, :format => :json
    verify_pagination_results!(1)
  end

  test 'should expose restful endpoint' do
    get :restful_show, :id => @payment.payment_id
    assert_redirected_to account_payment_path(@payment.account_id, @payment.payment_id)

    # Search by external_key
    get :restful_show, :id => @payment.payment_external_key
    assert_redirected_to account_payment_path(@payment.account_id, @payment.payment_id)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kaui-0.15.5 test/functional/kaui/payments_controller_test.rb
kaui-0.15.4 test/functional/kaui/payments_controller_test.rb
kaui-0.15.3 test/functional/kaui/payments_controller_test.rb
kaui-0.15.2 test/functional/kaui/payments_controller_test.rb
kaui-0.15.1 test/functional/kaui/payments_controller_test.rb
kaui-0.15.0 test/functional/kaui/payments_controller_test.rb