Sha256: 18629c984483771cdabe605e8543f2ef703df091dd9adcd02045ed78a3ce46f0

Contents?: true

Size: 1.4 KB

Versions: 6

Compression:

Stored size: 1.4 KB

Contents

require 'test_helper'

class Kaui::BundleTagsControllerTest < Kaui::FunctionalTestHelper

  test 'should handle Kill Bill errors when getting edit screen' do
    get :edit, :account_id => @account.account_id
    assert_redirected_to account_path(@account.account_id)
    assert_equal 'Required parameter missing: bundle_id', flash[:error]

    bundle_id = SecureRandom.uuid.to_s
    get :edit, :account_id => @account.account_id, :bundle_id => bundle_id
    assert_redirected_to account_path(@account.account_id)
    assert_equal "Error while communicating with the Kill Bill server: Error 404: Object id=#{bundle_id} type=BUNDLE doesn't exist!", flash[:error]
  end

  test 'should get edit' do
    get :edit, :account_id => @account.account_id, :bundle_id => @bundle.bundle_id
    assert_response 200
    assert_not_nil assigns(:bundle_id)
    assert_not_nil assigns(:tag_names)
    assert_not_nil assigns(:available_tags)
  end

  test 'should update tags' do
    post :update,
         :account_id => @account.account_id,
         :bundle_id => @bundle.bundle_id,
         'tag_00000000-0000-0000-0000-000000000001' => 'AUTO_PAY_OFF',
         'tag_00000000-0000-0000-0000-000000000005' => 'MANUAL_PAY',
         'tag_00000000-0000-0000-0000-000000000003' => 'OVERDUE_ENFORCEMENT_OFF'
    assert_redirected_to account_bundles_path(@account.account_id)
    assert_equal 'Bundle tags successfully set', flash[:notice]
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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