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