From 08ee320e23ed60a77b95d78d5af28731290790d9 Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Thu, 2 Jun 2022 16:50:45 +0200 Subject: [PATCH] #139 fix coding standard and remove none for author patch (because there is always an author) --- .../patches/reports_controller_patch.rb | 8 +++--- test/functional/reports_controller_test.rb | 27 +++++++++---------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/lib/additionals/patches/reports_controller_patch.rb b/lib/additionals/patches/reports_controller_patch.rb index 26bacbb3..f93520ef 100644 --- a/lib/additionals/patches/reports_controller_patch.rb +++ b/lib/additionals/patches/reports_controller_patch.rb @@ -15,9 +15,11 @@ module Additionals return if @rows.nil? if Setting.issue_group_assignment? && params[:detail] == 'assigned_to' - @rows = @project.visible_principals + [User.new(:firstname => "[#{l(:label_none)}]")] - elsif %w[assigned_to author].include? params[:detail] - @rows = @project.visible_users + [User.new(:firstname => "[#{l(:label_none)}]")] + @rows = @project.visible_principals + [User.new(firstname: "[#{l :label_none}]")] + elsif params[:detail] == 'assigned_to' + @rows = @project.visible_users + [User.new(firstname: "[#{l :label_none}]")] + elsif params[:detail] == 'author' + @rows = @project.visible_users end end end diff --git a/test/functional/reports_controller_test.rb b/test/functional/reports_controller_test.rb index 044f658a..f10a6e9e 100644 --- a/test/functional/reports_controller_test.rb +++ b/test/functional/reports_controller_test.rb @@ -16,23 +16,20 @@ class ReportsControllerTest < Additionals::ControllerTest Issue.delete_all Issue.generate! Issue.generate! - Issue.generate!(:status_id => 5) - Issue.generate!(:assigned_to_id => 2) + Issue.generate! status_id: 5 + Issue.generate! assigned_to_id: 2 + + get :issue_report_details, + params: { id: 1, + detail: 'assigned_to' } - get( - :issue_report_details, - :params => { - :id => 1, - :detail => 'assigned_to' - } - ) assert_select 'table.list tbody :last-child' do - assert_select 'td', :text => "[#{I18n.t(:label_none)}]" - assert_select ':nth-child(2)', :text => '2' # status:1 - assert_select ':nth-child(6)', :text => '1' # status:5 - assert_select ':nth-child(8)', :text => '2' # open - assert_select ':nth-child(9)', :text => '1' # closed - assert_select ':nth-child(10)', :text => '3' # total + assert_select 'td', text: "[#{I18n.t :label_none}]" + assert_select ':nth-child(2)', text: '2' # status:1 + assert_select ':nth-child(6)', text: '1' # status:5 + assert_select ':nth-child(8)', text: '2' # open + assert_select ':nth-child(9)', text: '1' # closed + assert_select ':nth-child(10)', text: '3' # total end end end