Skip to content

Commit

Permalink
all tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Munteanu committed Aug 1, 2024
1 parent dc26301 commit 9077a3b
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions test/functional/issues_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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

Expand All @@ -74,20 +74,20 @@ 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
issue = issues :issues_004
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

Expand All @@ -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

Expand All @@ -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 }

Expand All @@ -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 }

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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")
Expand All @@ -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 }

Expand All @@ -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")
Expand Down

0 comments on commit 9077a3b

Please sign in to comment.