diff --git a/app/controllers/summoners_controller.rb b/app/controllers/summoners_controller.rb index 995692e..ab8a2fc 100644 --- a/app/controllers/summoners_controller.rb +++ b/app/controllers/summoners_controller.rb @@ -286,7 +286,7 @@ def summoner_params def does_not_play_response(args, role, recency, champion = nil) role_type = if role.present? - args[:role] = ChampionGGApi::ROLES[role.to_sym].humanize + args[:role] = role.to_s.humanize :role_specified else :no_role_specified @@ -305,7 +305,7 @@ def does_not_play_response(args, role, recency, champion = nil) def multiple_roles_response(args, collection, recency) args[:roles] = collection.sort.map do |role| - ChampionGGApi::ROLES[role.to_sym].humanize + role.to_s.humanize end.en.conjunction(article: false) recency_type = recency.present? ? :recency : :no_recency @@ -426,7 +426,7 @@ def process_performance_request(options = {}) end end end - args[:role] = ChampionGGApi::ROLES[role.to_sym].humanize if role.present? + args[:role] = role.to_s.humanize if role.present? @processed_request = { args: args, diff --git a/spec/controllers/summoners_controller_spec.rb b/spec/controllers/summoners_controller_spec.rb index 51dd3b4..c0985b0 100644 --- a/spec/controllers/summoners_controller_spec.rb +++ b/spec/controllers/summoners_controller_spec.rb @@ -468,7 +468,7 @@ name: 'Hero man', champion: 'Shyvana', region: 'NA1', - role: 'DUO_CARRY', + role: 'ADC', list_order: 'highest', metric: '', position_details: '', @@ -478,13 +478,13 @@ before :each do match_data = [ - { match: { win: true }, summoner_performance: { spell1_id: 3, spell2_id: 4, champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, summoner_performance: { spell1_id: 3, spell2_id: 4, champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, summoner_performance: { spell1_id: 3, spell2_id: 4, champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, summoner_performance: { spell1_id: 3, spell2_id: 4, champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, summoner_performance: { spell1_id: 3, spell2_id: 4, champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: false }, summoner_performance: { spell1_id: 4, spell2_id: 6, champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: false }, summoner_performance: { spell1_id: 4, spell2_id: 6, champion_id: 102, role: 'DUO_CARRY' } }, + { match: { win: true }, summoner_performance: { spell1_id: 3, spell2_id: 4, champion_id: 102, role: 'ADC' } }, + { match: { win: true }, summoner_performance: { spell1_id: 3, spell2_id: 4, champion_id: 102, role: 'ADC' } }, + { match: { win: true }, summoner_performance: { spell1_id: 3, spell2_id: 4, champion_id: 102, role: 'ADC' } }, + { match: { win: true }, summoner_performance: { spell1_id: 3, spell2_id: 4, champion_id: 102, role: 'ADC' } }, + { match: { win: true }, summoner_performance: { spell1_id: 3, spell2_id: 4, champion_id: 102, role: 'ADC' } }, + { match: { win: false }, summoner_performance: { spell1_id: 4, spell2_id: 6, champion_id: 102, role: 'ADC' } }, + { match: { win: false }, summoner_performance: { spell1_id: 4, spell2_id: 6, champion_id: 102, role: 'ADC' } }, ] @matches = create_list(:match, match_data.length) @@ -603,7 +603,7 @@ name: 'Hero man', champion: 'Shyvana', region: 'NA1', - role: 'DUO_CARRY', + role: 'ADC', list_order: 'highest', list_size: 1, metric: '', @@ -614,17 +614,17 @@ before :each do match_data = [ - { match: { win: true }, ban: { champion_id: 42 }, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, ban: { champion_id: 42 }, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, ban: { champion_id: 42 }, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, ban: { champion_id: 42 }, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, ban: { champion_id: 42 }, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, ban: { champion_id: 45 }, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, ban: { champion_id: 45 }, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: false }, ban: { champion_id: 41 }, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: false }, ban: { champion_id: 41 }, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: false }, ban: { champion_id: 41 }, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: false }, ban: { champion_id: 41 }, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, + { match: { win: true }, ban: { champion_id: 42 }, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: true }, ban: { champion_id: 42 }, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: true }, ban: { champion_id: 42 }, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: true }, ban: { champion_id: 42 }, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: true }, ban: { champion_id: 42 }, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: true }, ban: { champion_id: 45 }, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: true }, ban: { champion_id: 45 }, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: false }, ban: { champion_id: 41 }, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: false }, ban: { champion_id: 41 }, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: false }, ban: { champion_id: 41 }, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: false }, ban: { champion_id: 41 }, summoner_performance: { champion_id: 102, role: 'ADC' } }, ] @matches = create_list(:match, match_data.length) @@ -922,7 +922,7 @@ name: 'Hero man', champion: 'Shyvana', region: 'NA1', - role: 'DUO_CARRY', + role: 'ADC', list_order: 'highest', list_size: 2, metric: '', @@ -937,17 +937,17 @@ @incomplete_build = [3089, 3086, 3085, 3083, 2303, 3512] @partial_build = [3083, 2303, 3512] match_data = [ - { match: { win: true }, build: @complete_build2, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, build: @complete_build2, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, build: @complete_build, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, build: @complete_build, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, build: @complete_build.reverse, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: false }, build: @incomplete_build, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: false }, build: @incomplete_build, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, build: @partial_build, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, build: @partial_build, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, build: @partial_build, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, - { match: { win: true }, build: @partial_build, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' } }, + { match: { win: true }, build: @complete_build2, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: true }, build: @complete_build2, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: true }, build: @complete_build, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: true }, build: @complete_build, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: true }, build: @complete_build.reverse, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: false }, build: @incomplete_build, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: false }, build: @incomplete_build, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: true }, build: @partial_build, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: true }, build: @partial_build, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: true }, build: @partial_build, summoner_performance: { champion_id: 102, role: 'ADC' } }, + { match: { win: true }, build: @partial_build, summoner_performance: { champion_id: 102, role: 'ADC' } }, ] @matches = create_list(:match, match_data.length) summoner = create(:summoner, name: 'Hero man') @@ -1237,7 +1237,7 @@ before :each do @matches = create_list(:match, 6) match_data = [ - { match: { win: true }, summoner_performance: { champion_id: 102, role: 'DUO_CARRY' }, opponent: { champion_id: 40 } }, + { match: { win: true }, summoner_performance: { champion_id: 102, role: 'ADC' }, opponent: { champion_id: 40 } }, { match: { win: false }, summoner_performance: { champion_id: 102, role: 'MIDDLE' }, opponent: { champion_id: 50 } }, { match: { win: true }, summoner_performance: { champion_id: 102, role: 'MIDDLE' }, opponent: { champion_id: 60 } }, { match: { win: true }, summoner_performance: { champion_id: 102, role: 'JUNGLE' }, opponent: { champion_id: 40 } }, @@ -1431,7 +1431,7 @@ context 'with incomplete results' do before :each do - summoner_params[:role] = 'DUO_CARRY' + summoner_params[:role] = 'ADC' end context 'with recency' do @@ -1624,7 +1624,7 @@ before :each do matches = create_list(:match, 5) match_data = [ - { match: { win: true }, summoner_performance: { champion_id: 18, role: 'DUO_CARRY' } }, + { match: { win: true }, summoner_performance: { champion_id: 18, role: 'ADC' } }, { match: { win: false }, summoner_performance: { champion_id: 18, role: 'MIDDLE' } }, { match: { win: true }, summoner_performance: { champion_id: 20, role: 'MIDDLE' } }, { match: { win: true }, summoner_performance: { champion_id: 20, role: 'JUNGLE' } }, @@ -2249,7 +2249,7 @@ name: 'Hero man', region: 'NA1', champion: 'Tristana', - role: 'DUO_CARRY', + role: 'ADC', recency: '' } end @@ -2258,11 +2258,11 @@ @match1 = create(:match) @match2 = create(:match) summoner_performance = @match1.summoner_performances.first - summoner_performance.update!(champion_id: 18, role: 'DUO_CARRY') + summoner_performance.update!(champion_id: 18, role: 'ADC') summoner_performance.summoner.update!(name: 'Hero man') @match2.summoner_performances.first.update( champion_id: 18, - role: 'DUO_CARRY', + role: 'ADC', summoner: summoner_performance.summoner ) end @@ -2366,7 +2366,7 @@ context 'with multiple roles' do before :each do - @match2.summoner_performances.first.update(role: 'DUO_SUPPORT') + @match2.summoner_performances.first.update(role: 'SUPPORT') end it 'should prompt to specify a role' do @@ -2384,7 +2384,7 @@ { name: 'Hero man', champion: 'Tristana', - role: 'DUO_CARRY', + role: 'ADC', position_details: 'kills', region: 'NA1', recency: '', @@ -2396,11 +2396,11 @@ @match1 = create(:match) @match2 = create(:match) summoner_performance = @match1.summoner_performances.first - summoner_performance.update!(champion_id: 18, role: 'DUO_CARRY') + summoner_performance.update!(champion_id: 18, role: 'ADC') summoner_performance.summoner.update!(name: 'Hero man') @match2.summoner_performances.first.update( champion_id: 18, - role: 'DUO_CARRY', + role: 'ADC', summoner: summoner_performance.summoner ) end @@ -2537,7 +2537,7 @@ context 'with multiple roles' do before :each do - @match2.summoner_performances.first.update(role: 'DUO_SUPPORT') + @match2.summoner_performances.first.update(role: 'SUPPORT') end context 'with recency' do