Sha256: 585030c13f8293edc0139c47156e2c119477845e395062045a7cf97aced1ecd2

Contents?: true

Size: 1.69 KB

Versions: 11

Compression:

Stored size: 1.69 KB

Contents

require 'test_helper'

class Kaui::BundlesControllerTest < Kaui::FunctionalTestHelper

  test 'should get index' do
    get :index
    assert_response 200
  end

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

  test 'should search bundles' do
    # Test search
    get :pagination, :sSearch => 'foo', :format => :json
    verify_pagination_results!
  end

  test 'should find bundle by id' do
    get :show, :id => @bundle.bundle_id
    assert_response 200
    assert_not_nil assigns(:bundle)
    assert_not_nil assigns(:account)
  end

  test 'should get transfer' do
    get :transfer, :id => @bundle.bundle_id
    assert_response 200
    assert_not_nil assigns(:bundle)
    assert_not_nil assigns(:account)
  end

  test 'should transfer bundle default policy' do
    check_bundle_owner(@account.account_id)

    post :do_transfer,
         :id              => @bundle.bundle_id,
         :new_account_key => @account2.external_key
    assert_response 302
    assert_equal 'Bundle was successfully transferred', flash[:notice]

    check_bundle_owner(@account2.account_id)
  end

  test 'should transfer bundle immediately' do
    check_bundle_owner(@account.account_id)

    post :do_transfer,
         :id              => @bundle.bundle_id,
         :new_account_key => @account2.external_key,
         :billing_policy  => 'IMMEDIATE'
    assert_response 302
    assert_equal 'Bundle was successfully transferred', flash[:notice]

    check_bundle_owner(@account2.account_id)
  end

  private

  def check_bundle_owner(new_owner)
    assert_equal new_owner, Kaui::Bundle.find_by_external_key(@bundle.external_key, options).account_id
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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