diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index b2033b3..66999ed 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -19,7 +19,7 @@ class IssuesControllerTest < RedmineIssueViewColumns::ControllerTest def setup prepare_tests - @global_settings = { 'column_names' => %w[created_on updated_on]} + @global_settings = { "column_names" => %w[created_on updated_on] } end def test_show_author_column_for_related_issues_with_project_setting @@ -28,7 +28,7 @@ def test_show_author_column_for_related_issues_with_project_setting get :show, params: { id: issue.id } assert_response :success - assert_select '#relations td.author' + assert_select "#relations td.author" end def test_show_default_columns_for_related_issues_without_global_setting @@ -37,14 +37,14 @@ def test_show_default_columns_for_related_issues_without_global_setting IssueRelation.create! issue_from: related_issue, issue_to: issue, - relation_type: 'relates' + relation_type: "relates" @request.session[:user_id] = 1 - with_plugin_settings 'redmine_issue_view_columns', issue_list_defaults: {} do + with_plugin_settings "redmine_issue_view_columns", issue_list_defaults: {} do get :show, params: { id: issue.id } assert_response :success - assert_select '#relations td.due_date' + assert_select "#relations td.due_date" end end @@ -54,16 +54,16 @@ def test_show_custom_columns_for_related_issues_with_global_setting IssueRelation.create! issue_from: related_issue, issue_to: issue, - relation_type: 'relates' + relation_type: "relates" @request.session[:user_id] = 1 - with_plugin_settings 'redmine_issue_view_columns', + with_plugin_settings "redmine_issue_view_columns", issue_list_defaults: @global_settings do get :show, params: { id: issue.id } assert_response :success - assert_select '#relations td.created_on' - assert_select '#relations td.updated_on' + assert_select "#relations td.created_on" + assert_select "#relations td.updated_on" end end @@ -74,7 +74,7 @@ def test_show_author_column_for_subtasks_with_project_setting get :show, params: { id: issue.id } assert_response :success - assert_select '#issue_tree td.author' + assert_select "#issue_tree td.author" end def test_show_default_columns_for_subtasks_without_global_setting @@ -82,12 +82,12 @@ def test_show_default_columns_for_subtasks_without_global_setting Issue.generate! project_id: 2, parent_issue_id: issue.id @request.session[:user_id] = 1 - with_plugin_settings 'redmine_issue_view_columns', + with_plugin_settings "redmine_issue_view_columns", issue_list_defaults: {} do get :show, params: { id: issue.id } assert_response :success - assert_select '#issue_tree td.due_date' + assert_select "#issue_tree td.due_date" end end @@ -96,13 +96,13 @@ def test_show_custom_columns_for_subtasks_with_global_setting Issue.generate! project_id: 2, parent_issue_id: issue.id @request.session[:user_id] = 1 - with_plugin_settings 'redmine_issue_view_columns', + with_plugin_settings "redmine_issue_view_columns", issue_list_defaults: @global_settings do get :show, params: { id: issue.id } assert_response :success - assert_select '#issue_tree td.created_on' - assert_select '#issue_tree td.updated_on' + assert_select "#issue_tree td.created_on" + assert_select "#issue_tree td.updated_on" end end @@ -112,16 +112,16 @@ def test_show_without_closed_relations related_issue = Issue.generate! project_id: 2, status_id: 1 open_relation = IssueRelation.create! issue_from: related_issue, issue_to: issue, - relation_type: 'relates' + relation_type: "relates" closed_issue = Issue.generate! project_id: 2, status_id: 5 closed_relation = IssueRelation.create! issue_from: closed_issue, issue_to: issue, - relation_type: 'relates' + relation_type: "relates" @request.session[:user_id] = 1 - with_plugin_settings 'redmine_issue_view_columns', - issue_scope: 'without_closed_by_default', + with_plugin_settings "redmine_issue_view_columns", + issue_scope: "without_closed_by_default", issue_list_defaults: @global_settings do get :show, params: { id: issue.id } @@ -138,8 +138,8 @@ def test_show_without_closed_subtasks closed_issue = Issue.generate! project_id: 1, parent_issue_id: issue.id, status_id: 5 @request.session[:user_id] = 1 - with_plugin_settings 'redmine_issue_view_columns', - issue_scope: 'without_closed_by_default', + with_plugin_settings "redmine_issue_view_columns", + issue_scope: "without_closed_by_default", issue_list_defaults: @global_settings do get :show, params: { id: issue.id } @@ -159,7 +159,7 @@ def test_render_issue_tree_dir_file_model @request.session[:user_id] = 1 with_plugin_settings "redmine_issue_view_columns", - sort_dir_file_model: '1' do + sort_dir_file_model: "1" do get :show, params: { id: parent_issue.id } assert_response :success @@ -186,7 +186,7 @@ def test_render_issue_tree_default @request.session[:user_id] = 1 with_plugin_settings "redmine_issue_view_columns", - sort_dir_file_model: '0' do + sort_dir_file_model: "0" do get :show, params: { id: parent_issue.id } assert_response :success @@ -211,14 +211,14 @@ def test_min_width_setting_applies @request.session[:user_id] = 1 with_plugin_settings "redmine_issue_view_columns", - columns_min_width: 'Status:300px' do + columns_min_width: "status:300px" do get :show, params: { id: issue.id } assert_response :success - assert_select "td.status", true, "Expected 'Status' column to be present" + assert_select "th.status", true, "Expected 'Status' column to be present" - style = css_select("td.status").first['style'] + style = css_select("th.status").first["style"] # Ensure the style attribute contains the min-width property assert_match(/min-width:\s*300px/, style, "Expected 'Status' column to have min-width of 300px") @@ -234,12 +234,12 @@ def test_sorting_criteria_and_order_for_columns @request.session[:user_id] = 1 with_plugin_settings "redmine_issue_view_columns", - columns_sorting: 'Status:ASC,Author:DESC' do + columns_sorting: "status:ASC,author:DESC" do get :show, params: { id: parent_issue.id } assert_response :success - issue_rows = css_select('#issue_tree tr').map(&:to_html) + issue_rows = css_select("#issue_tree tr").map(&:to_html) issue_ids = issue_rows.map { |row| row[/id="issue-(\d+)"/, 1].to_i } @@ -266,7 +266,7 @@ def test_collapsed_issue_is_not_displayed grandchild_issue_row = css_select("tr#issue-#{grandchild_issue.id}").first - style = grandchild_issue_row['style'] + style = grandchild_issue_row["style"] # Check if the style attribute of children of issues included in collapsed_ids includes 'display: none' assert_match(/display:\s*none/, style, "Expected grandchild issue to have display: none")