Sha256: ee3a63b931bc444349b8aa53061b8a62c7f04cf315ff3cf047208ac0309fe39a

Contents?: true

Size: 966 Bytes

Versions: 22

Compression:

Stored size: 966 Bytes

Contents

require 'uri'
require 'test_helper'

module Shipit
  class CCMenuUrlControllerTest < ActionController::TestCase
    setup do
      @stack = shipit_stacks(:shipit)
      @user = shipit_users(:walrus)
      session[:user_id] = @user.id
    end

    test ":fetch returns ok with json" do
      get :fetch, params: {stack_id: @stack.to_param}
      assert_response :ok
      data = JSON.parse(response.body)
      assert_includes data, 'ccmenu_url'
    end

    test ":fetch creates a read only api client" do
      assert_difference 'ApiClient.count' do
        get :fetch, params: {stack_id: @stack.to_param}
      end
    end

    test ":fetch url includes api token on query string" do
      get :fetch, params: {stack_id: @stack.to_param}
      data = JSON.parse(response.body)
      client = ApiClient.last
      query = Rack::Utils.parse_nested_query(URI(data['ccmenu_url']).query)
      assert_equal client.authentication_token, query['token']
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
shipit-engine-0.31.0 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.30.0 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.29.0 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.28.1 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.28.0 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.27.1 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.27.0 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.26.0 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.25.1 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.25.0 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.24.0 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.23.1 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.23.0 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.22.0 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.21.0 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.20.1 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.20.0 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.19.0 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.18.1 test/controllers/ccmenu_controller_test.rb
shipit-engine-0.18.0 test/controllers/ccmenu_controller_test.rb