OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Spec adjustments as suggested by @dombesz
Jonas Jabari4913e4d9714b
diff --git a/spec/features/projects/project_custom_fields/overview_page/dialog/inputs_spec.rb b/spec/features/projects/project_custom_fields/overview_page/dialog/inputs_spec.rbindex b95abbc8d32..0d4b5f53637 100644--- a/spec/features/projects/project_custom_fields/overview_page/dialog/inputs_spec.rb+++ b/spec/features/projects/project_custom_fields/overview_page/dialog/inputs_spec.rb@@ -26,11 +26,11 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'-require_relative '../shared_context'+require "spec_helper"+require_relative "../shared_context"-RSpec.describe 'Edit project custom fields on project overview page', :js do- include_context 'with seeded projects, members and project custom fields'+RSpec.describe "Edit project custom fields on project overview page", :js do+ include_context "with seeded projects, members and project custom fields"let(:overview_page) { Pages::Projects::Show.new(project) }@@ -39,13 +39,13 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dooverview_page.visit_pageend- describe 'with correct initialization and input behaviour' do- describe 'with input fields' do+ describe "with correct initialization and input behaviour" do+ describe "with input fields" dolet(:section) { section_for_input_fields }let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a custom field checkbox' do- it 'shows the correct value if given' do+ shared_examples "a custom field checkbox" do+ it "shows the correct value if given" dooverview_page.open_edit_dialog_for_section(section)dialog.within_async_content(close_after_yield: true) do@@ -57,7 +57,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'is unchecked if no value and no default value is given' do+ it "is unchecked if no value and no default value is given" docustom_field.custom_values.destroy_alloverview_page.open_edit_dialog_for_section(section)@@ -67,7 +67,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'shows default value if no value is given' do+ it "shows default value if no value is given" docustom_field.custom_values.destroy_allcustom_field.update!(default_value: true)@@ -88,8 +88,8 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- shared_examples 'a custom field input' do- it 'shows the correct value if given' do+ shared_examples "a custom field input" do+ it "shows the correct value if given" dooverview_page.open_edit_dialog_for_section(section)dialog.within_async_content(close_after_yield: true) do@@ -97,7 +97,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'shows a blank input if no value or default value is given' do+ it "shows a blank input if no value or default value is given" docustom_field.custom_values.destroy_alloverview_page.open_edit_dialog_for_section(section)@@ -107,7 +107,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'shows the default value if no value is given' do+ it "shows the default value if no value is given" docustom_field.custom_values.destroy_allcustom_field.update!(default_value:)@@ -119,8 +119,8 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- shared_examples 'a rich text custom field input' do- it 'shows the correct value if given' do+ shared_examples "a rich text custom field input" do+ it "shows the correct value if given" dooverview_page.open_edit_dialog_for_section(section)dialog.within_async_content(close_after_yield: true) do@@ -128,7 +128,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'shows a blank input if no value or default value is given' do+ it "shows a blank input if no value or default value is given" docustom_field.custom_values.destroy_alloverview_page.open_edit_dialog_for_section(section)@@ -138,7 +138,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'shows the default value if no value is given' do+ it "shows the default value if no value is given" docustom_field.custom_values.destroy_allcustom_field.update!(default_value:)@@ -150,74 +150,72 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- describe 'with boolean CF' do+ describe "with boolean CF" dolet(:custom_field) { boolean_project_custom_field }- let(:default_value) { false }- let(:expected_blank_value) { false }let(:expected_initial_value) { true }- it_behaves_like 'a custom field checkbox'+ it_behaves_like "a custom field checkbox"end- describe 'with string CF' do+ describe "with string CF" dolet(:custom_field) { string_project_custom_field }- let(:default_value) { 'Default value' }- let(:expected_blank_value) { '' }- let(:expected_initial_value) { 'Foo' }+ let(:default_value) { "Default value" }+ let(:expected_blank_value) { "" }+ let(:expected_initial_value) { "Foo" }- it_behaves_like 'a custom field input'+ it_behaves_like "a custom field input"end- describe 'with integer CF' do+ describe "with integer CF" dolet(:custom_field) { integer_project_custom_field }let(:default_value) { 789 }- let(:expected_blank_value) { '' }+ let(:expected_blank_value) { "" }let(:expected_initial_value) { 123 }- it_behaves_like 'a custom field input'+ it_behaves_like "a custom field input"end- describe 'with float CF' do+ describe "with float CF" dolet(:custom_field) { float_project_custom_field }let(:default_value) { 789.123 }- let(:expected_blank_value) { '' }+ let(:expected_blank_value) { "" }let(:expected_initial_value) { 123.456 }- it_behaves_like 'a custom field input'+ it_behaves_like "a custom field input"end- describe 'with date CF' do+ describe "with date CF" dolet(:custom_field) { date_project_custom_field }let(:default_value) { Date.new(2026, 1, 1) }- let(:expected_blank_value) { '' }+ let(:expected_blank_value) { "" }let(:expected_initial_value) { Date.new(2024, 1, 1) }- it_behaves_like 'a custom field input'+ it_behaves_like "a custom field input"end- describe 'with text CF' do+ describe "with text CF" dolet(:custom_field) { text_project_custom_field }let(:field) { FormFields::Primerized::EditorFormField.new(custom_field) }- let(:default_value) { 'Default value' }- let(:expected_blank_value) { '' }+ let(:default_value) { "Default value" }+ let(:expected_blank_value) { "" }let(:expected_initial_value) { "Lorem\nipsum" } # TBD: why is the second newline missing?- it_behaves_like 'a rich text custom field input'+ it_behaves_like "a rich text custom field input"endend- describe 'with single select fields' do+ describe "with single select fields" dolet(:section) { section_for_select_fields }let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a autocomplete single select field' do- it 'shows the correct value if given' do+ shared_examples "a autocomplete single select field" do+ it "shows the correct value if given" dooverview_page.open_edit_dialog_for_section(section)field.expect_selected(expected_initial_value)end- it 'shows a blank input if no value or default value is given' do+ it "shows a blank input if no value or default value is given" docustom_field.custom_values.destroy_alloverview_page.open_edit_dialog_for_section(section)@@ -225,7 +223,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dofield.expect_blankend- it 'filters the list based on the input' do+ it "filters the list based on the input" dooverview_page.open_edit_dialog_for_section(section)field.search(second_option)@@ -235,7 +233,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dofield.expect_no_option(third_option)end- it 'enables the user to select a single value from a list' do+ it "enables the user to select a single value from a list" dooverview_page.open_edit_dialog_for_section(section)field.search(second_option)@@ -250,7 +248,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dofield.expect_not_selected(second_option)end- it 'clears the input if clicked on the clear button' do+ it "clears the input if clicked on the clear button" dooverview_page.open_edit_dialog_for_section(section)field.clear@@ -259,7 +257,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- describe 'with single select list CF' do+ describe "with single select list CF" dolet(:custom_field) { list_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }@@ -269,9 +267,9 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dolet(:second_option) { custom_field.custom_options.second.value }let(:third_option) { custom_field.custom_options.third.value }- it_behaves_like 'a autocomplete single select field'+ it_behaves_like "a autocomplete single select field"- it 'shows the default value if no value is given' do+ it "shows the default value if no value is given" docustom_field.custom_values.destroy_allcustom_field.custom_options.first.update!(default_value: true)@@ -282,7 +280,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- describe 'with single version select list CF' do+ describe "with single version select list CF" dolet(:custom_field) { version_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }@@ -292,35 +290,35 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dolet(:second_option) { second_version.name }let(:third_option) { third_version.name }- it_behaves_like 'a autocomplete single select field'+ it_behaves_like "a autocomplete single select field"- describe 'with correct version scoping' do- context 'with a version on a different project' do+ describe "with correct version scoping" do+ context "with a version on a different project" dolet!(:version_in_other_project) do- create(:version, name: 'Version 1 in other project', project: other_project)+ create(:version, name: "Version 1 in other project", project: other_project)end- it 'shows only versions that are associated with this project' do+ it "shows only versions that are associated with this project" dooverview_page.open_edit_dialog_for_section(section)- field.search('Version 1')+ field.search("Version 1")field.expect_option(first_version.name)field.expect_no_option(version_in_other_project.name)endend- context 'with a closed version' do- let!(:closed_version) { create(:version, name: 'Closed version', project:, status: 'closed') }+ context "with a closed version" do+ let!(:closed_version) { create(:version, name: "Closed version", project:, status: "closed") }before docustom_field.update(allow_non_open_versions:)end- context 'when non-open versions are not allowed' do+ context "when non-open versions are not allowed" dolet(:allow_non_open_versions) { false }- it 'does not shows closed version option' do+ it "does not shows closed version option" dooverview_page.open_edit_dialog_for_section(section)field.open_options@@ -329,10 +327,10 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- context 'when non-open versions are allowed' do+ context "when non-open versions are allowed" dolet(:allow_non_open_versions) { true }- it 'shows closed version option' do+ it "shows closed version option" dooverview_page.open_edit_dialog_for_section(section)field.open_options@@ -344,7 +342,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- describe 'with single user select list CF' do+ describe "with single user select list CF" dolet(:custom_field) { user_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }@@ -354,62 +352,62 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dolet(:second_option) { another_member_in_project.name }let(:third_option) { one_more_member_in_project.name }- it_behaves_like 'a autocomplete single select field'+ it_behaves_like "a autocomplete single select field"- describe 'with correct user scoping' do+ describe "with correct user scoping" dolet!(:member_in_other_project) docreate(:user,- firstname: 'Member 1',- lastname: 'In other Project',+ firstname: "Member 1",+ lastname: "In other Project",member_with_roles: { other_project => reader_role })end- it 'shows only users that are members of the project' do+ it "shows only users that are members of the project" dooverview_page.open_edit_dialog_for_section(section)- field.search('Member 1')+ field.search("Member 1")field.expect_option(member_in_project.name)field.expect_no_option(member_in_other_project.name)endend- describe 'with support for user groups' do+ describe "with support for user groups" dolet!(:member_in_other_project) docreate(:user,- firstname: 'Member 1',- lastname: 'In other Project',+ firstname: "Member 1",+ lastname: "In other Project",member_with_roles: { other_project => reader_role })endlet!(:group) do- create(:group, name: 'Group 1 in project',+ create(:group, name: "Group 1 in project",member_with_roles: { project => reader_role })endlet!(:group_in_other_project) do- create(:group, name: 'Group 1 in other project', members: [member_in_other_project],+ create(:group, name: "Group 1 in other project", members: [member_in_other_project],member_with_roles: { other_project => reader_role })end- it 'shows only groups that are associated with this project' do+ it "shows only groups that are associated with this project" dooverview_page.open_edit_dialog_for_section(section)- field.search('Group 1')+ field.search("Group 1")field.expect_option(group.name)field.expect_no_option(group_in_other_project.name)endend- describe 'with support for placeholder users' do+ describe "with support for placeholder users" dolet!(:placeholder_user) do- create(:placeholder_user, name: 'Placeholder User',+ create(:placeholder_user, name: "Placeholder User",member_with_roles: { project => reader_role })end- it 'shows the placeholder user' do+ it "shows the placeholder user" dooverview_page.open_edit_dialog_for_section(section)- field.search('Placeholder User')+ field.search("Placeholder User")field.expect_option(placeholder_user.name)end@@ -417,18 +415,18 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- describe 'with multi select fields' do+ describe "with multi select fields" dolet(:section) { section_for_multi_select_fields }let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a autocomplete multi select field' do- it 'shows the correct value if given' do+ shared_examples "a autocomplete multi select field" do+ it "shows the correct value if given" dooverview_page.open_edit_dialog_for_section(section)field.expect_selected(*expected_initial_value)end- it 'shows a blank input if no value or default value is given' do+ it "shows a blank input if no value or default value is given" docustom_field.custom_values.destroy_alloverview_page.open_edit_dialog_for_section(section)@@ -436,7 +434,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dofield.expect_blankend- it 'filters the list based on the input' do+ it "filters the list based on the input" dooverview_page.open_edit_dialog_for_section(section)field.search(second_option)@@ -446,7 +444,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dofield.expect_no_option(third_option)end- it 'allows to select multiple values' do+ it "allows to select multiple values" docustom_field.custom_values.destroy_alloverview_page.open_edit_dialog_for_section(section)@@ -458,7 +456,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dofield.expect_selected(third_option)end- it 'allows to remove selected values' do+ it "allows to remove selected values" docustom_field.custom_values.destroy_alloverview_page.open_edit_dialog_for_section(section)@@ -472,7 +470,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dofield.expect_not_selected(third_option)end- it 'allows to remove all selected values at once' do+ it "allows to remove all selected values at once" docustom_field.custom_values.destroy_alloverview_page.open_edit_dialog_for_section(section)@@ -487,7 +485,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- describe 'with multi select list CF' do+ describe "with multi select list CF" dolet(:custom_field) { multi_list_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }@@ -497,9 +495,9 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dolet(:second_option) { custom_field.custom_options.second.value }let(:third_option) { custom_field.custom_options.third.value }- it_behaves_like 'a autocomplete multi select field'+ it_behaves_like "a autocomplete multi select field"- it 'shows the default value if no value is given' do+ it "shows the default value if no value is given" domulti_list_project_custom_field.custom_values.destroy_allmulti_list_project_custom_field.custom_options.first.update!(default_value: true)@@ -512,7 +510,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- describe 'with multi version select list CF' do+ describe "with multi version select list CF" dolet(:custom_field) { multi_version_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }@@ -522,9 +520,9 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dolet(:second_option) { second_version.name }let(:third_option) { third_version.name }- it_behaves_like 'a autocomplete multi select field'+ it_behaves_like "a autocomplete multi select field"- describe 'with correct version scoping' do+ describe "with correct version scoping" docontext "with a version on a different project" dolet!(:version_in_other_project) docreate(:version, name: "Version 1 in other project", project: other_project)@@ -574,7 +572,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- describe 'with multi user select list CF' do+ describe "with multi user select list CF" dolet(:custom_field) { multi_user_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }@@ -584,90 +582,90 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dolet(:second_option) { another_member_in_project.name }let(:third_option) { one_more_member_in_project.name }- it_behaves_like 'a autocomplete multi select field'+ it_behaves_like "a autocomplete multi select field"- describe 'with correct user scoping' do+ describe "with correct user scoping" dolet!(:member_in_other_project) docreate(:user,- firstname: 'Member 1',- lastname: 'In other Project',+ firstname: "Member 1",+ lastname: "In other Project",member_with_roles: { other_project => reader_role })end- it 'shows only users that are members of the project' do+ it "shows only users that are members of the project" dooverview_page.open_edit_dialog_for_section(section)- field.search('Member 1')+ field.search("Member 1")field.expect_option(member_in_project.name)field.expect_no_option(member_in_other_project.name)endend- describe 'with support for user groups' do+ describe "with support for user groups" dolet!(:member_in_other_project) docreate(:user,- firstname: 'Member 1',- lastname: 'In other Project',+ firstname: "Member 1",+ lastname: "In other Project",member_with_roles: { other_project => reader_role })endlet!(:group) do- create(:group, name: 'Group 1 in project',+ create(:group, name: "Group 1 in project",member_with_roles: { project => reader_role })endlet!(:another_group) do- create(:group, name: 'Group 2 in project',+ create(:group, name: "Group 2 in project",member_with_roles: { project => reader_role })endlet!(:group_in_other_project) do- create(:group, name: 'Group 1 in other project', members: [member_in_other_project],+ create(:group, name: "Group 1 in other project", members: [member_in_other_project],member_with_roles: { other_project => reader_role })end- it 'shows only groups that are associated with this project' do+ it "shows only groups that are associated with this project" dooverview_page.open_edit_dialog_for_section(section)- field.search('Group 1')+ field.search("Group 1")field.expect_option(group.name)field.expect_no_option(group_in_other_project.name)end- it 'enables to select multiple user groups' do+ it "enables to select multiple user groups" dooverview_page.open_edit_dialog_for_section(section)- field.select_option('Group 1 in project')- field.select_option('Group 2 in project')+ field.select_option("Group 1 in project")+ field.select_option("Group 2 in project")- field.expect_selected('Group 1 in project')- field.expect_selected('Group 2 in project')+ field.expect_selected("Group 1 in project")+ field.expect_selected("Group 2 in project")endend- describe 'with support for placeholder users' do+ describe "with support for placeholder users" dolet!(:placeholder_user) do- create(:placeholder_user, name: 'Placeholder user',+ create(:placeholder_user, name: "Placeholder user",member_with_roles: { project => reader_role })endlet!(:another_placeholder_user) do- create(:placeholder_user, name: 'Another placeholder User',+ create(:placeholder_user, name: "Another placeholder User",member_with_roles: { project => reader_role })endlet!(:placeholder_user_in_other_project) do- create(:placeholder_user, name: 'Placeholder user in other project',+ create(:placeholder_user, name: "Placeholder user in other project",member_with_roles: { other_project => reader_role })end- it 'shows only placeholder users from this project' do+ it "shows only placeholder users from this project" dooverview_page.open_edit_dialog_for_section(section)- field.search('Placeholder User')+ field.search("Placeholder User")field.expect_option(placeholder_user.name)field.expect_option(another_placeholder_user.name)field.expect_no_option(placeholder_user_in_other_project.name)end- it 'enables to select multiple placeholder users' do+ it "enables to select multiple placeholder users" dooverview_page.open_edit_dialog_for_section(section)field.select_option(placeholder_user.name)diff --git a/spec/features/projects/project_custom_fields/overview_page/dialog/update_spec.rb b/spec/features/projects/project_custom_fields/overview_page/dialog/update_spec.rbindex 85d7d638f55..15f61de8bbe 100644--- a/spec/features/projects/project_custom_fields/overview_page/dialog/update_spec.rb+++ b/spec/features/projects/project_custom_fields/overview_page/dialog/update_spec.rb@@ -26,11 +26,11 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'-require_relative '../shared_context'+require "spec_helper"+require_relative "../shared_context"-RSpec.describe 'Edit project custom fields on project overview page', :js do- include_context 'with seeded projects, members and project custom fields'+RSpec.describe "Edit project custom fields on project overview page", :js do+ include_context "with seeded projects, members and project custom fields"let(:overview_page) { Pages::Projects::Show.new(project) }@@ -39,19 +39,19 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dooverview_page.visit_pageend- describe 'with correct updating behaviour' do- describe 'with input fields' do+ describe "with correct updating behaviour" do+ describe "with input fields" dolet(:section) { section_for_input_fields }let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a custom field checkbox' do- it 'sets the value to true if checked' do+ shared_examples "a custom field checkbox" do+ it "sets the value to true if checked" docustom_field.custom_values.destroy_alloverview_page.visit_pageoverview_page.within_custom_field_container(custom_field) do- expect(page).to have_content I18n.t('placeholders.default')+ expect(page).to have_content I18n.t("placeholders.default")endoverview_page.open_edit_dialog_for_section(section)@@ -66,7 +66,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'sets the value to false if unchecked' do+ it "sets the value to false if unchecked" dooverview_page.within_custom_field_container(custom_field) doexpect(page).to have_content "Yes"end@@ -83,7 +83,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'does not change the value if untouched' do+ it "does not change the value if untouched" dooverview_page.within_custom_field_container(custom_field) doexpect(page).to have_content "Yes"end@@ -101,14 +101,14 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- shared_examples 'a custom field input' do- it 'saves the value properly' do+ shared_examples "a custom field input" do+ it "saves the value properly" docustom_field.custom_values.destroy_alloverview_page.visit_pageoverview_page.within_custom_field_container(custom_field) do- expect(page).to have_content I18n.t('placeholders.default')+ expect(page).to have_content I18n.t("placeholders.default")endoverview_page.open_edit_dialog_for_section(section)@@ -123,7 +123,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'does not change the value if untouched' do+ it "does not change the value if untouched" dooverview_page.visit_pageoverview_page.within_custom_field_container(custom_field) do@@ -142,26 +142,26 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'removes the value properly' do+ it "removes the value properly" dooverview_page.within_custom_field_container(custom_field) doexpect(page).to have_content expected_initial_valueendoverview_page.open_edit_dialog_for_section(section)- field.fill_in(with: '')+ field.fill_in(with: "")dialog.submitdialog.expect_closedoverview_page.within_custom_field_container(custom_field) do- expect(page).to have_content I18n.t('placeholders.default')+ expect(page).to have_content I18n.t("placeholders.default")endendend- shared_examples 'a rich text custom field input' do- it 'saves the value properly' do+ shared_examples "a rich text custom field input" do+ it "saves the value properly" docustom_field.custom_values.destroy_alloverview_page.visit_page@@ -182,7 +182,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'does not change the value if untouched' do+ it "does not change the value if untouched" dooverview_page.visit_pageoverview_page.within_custom_field_container(custom_field) do@@ -201,14 +201,14 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'removes the value properly' do+ it "removes the value properly" dooverview_page.within_custom_field_container(custom_field) doexpect(page).to have_text(expected_initial_value)endoverview_page.open_edit_dialog_for_section(section)- field.set_value('')+ field.set_value("")dialog.submitdialog.expect_closed@@ -219,71 +219,70 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- describe 'with boolean CF' do+ describe "with boolean CF" dolet(:custom_field) { boolean_project_custom_field }let(:field) { FormFields::Primerized::InputField.new(custom_field) }- let(:expected_initial_value) { true }- it_behaves_like 'a custom field checkbox'+ it_behaves_like "a custom field checkbox"end- describe 'with string CF' do+ describe "with string CF" dolet(:custom_field) { string_project_custom_field }let(:field) { FormFields::Primerized::InputField.new(custom_field) }- let(:expected_initial_value) { 'Foo' }- let(:update_value) { 'Bar' }+ let(:expected_initial_value) { "Foo" }+ let(:update_value) { "Bar" }let(:expected_updated_value) { update_value }- it_behaves_like 'a custom field input'+ it_behaves_like "a custom field input"end- describe 'with integer CF' do+ describe "with integer CF" dolet(:custom_field) { integer_project_custom_field }let(:field) { FormFields::Primerized::InputField.new(custom_field) }let(:expected_initial_value) { 123 }let(:update_value) { 456 }let(:expected_updated_value) { update_value }- it_behaves_like 'a custom field input'+ it_behaves_like "a custom field input"end- describe 'with float CF' do+ describe "with float CF" dolet(:custom_field) { float_project_custom_field }let(:field) { FormFields::Primerized::InputField.new(custom_field) }let(:expected_initial_value) { 123.456 }let(:update_value) { 456.789 }let(:expected_updated_value) { update_value }- it_behaves_like 'a custom field input'+ it_behaves_like "a custom field input"end- describe 'with date CF' do+ describe "with date CF" dolet(:custom_field) { date_project_custom_field }let(:field) { FormFields::Primerized::InputField.new(custom_field) }- let(:expected_initial_value) { '01/01/2024' }+ let(:expected_initial_value) { "01/01/2024" }let(:update_value) { Date.new(2024, 1, 2) }- let(:expected_updated_value) { '01/02/2024' }+ let(:expected_updated_value) { "01/02/2024" }- it_behaves_like 'a custom field input'+ it_behaves_like "a custom field input"end- describe 'with text CF' do+ describe "with text CF" dolet(:custom_field) { text_project_custom_field }let(:field) { FormFields::Primerized::EditorFormField.new(custom_field) }let(:expected_initial_value) { "Lorem\nipsum" } # TBD: why is the second newline missing?let(:update_value) { "Dolor\n\nsit" }let(:expected_updated_value) { "Dolor\nsit" }- it_behaves_like 'a rich text custom field input'+ it_behaves_like "a rich text custom field input"endend- describe 'with select fields' do+ describe "with select fields" dolet(:section) { section_for_select_fields }let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a select field' do- it 'saves the value properly' do+ shared_examples "a select field" do+ it "saves the value properly" docustom_field.custom_values.destroy_alloverview_page.visit_page@@ -304,7 +303,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'does not change the value if untouched' do+ it "does not change the value if untouched" dooverview_page.visit_pageoverview_page.within_custom_field_container(custom_field) do@@ -324,7 +323,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'removes the value properly' do+ it "removes the value properly" dooverview_page.within_custom_field_container(custom_field) doexpect(page).to have_text first_optionend@@ -342,39 +341,39 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- describe 'with list CF' do+ describe "with list CF" dolet(:custom_field) { list_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }let(:first_option) { custom_field.custom_options.first.value }- it_behaves_like 'a select field'+ it_behaves_like "a select field"end- describe 'with version select CF' do+ describe "with version select CF" dolet(:custom_field) { version_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }let(:first_option) { first_version.name }- it_behaves_like 'a select field'+ it_behaves_like "a select field"end- describe 'with user select CF' do+ describe "with user select CF" dolet(:custom_field) { user_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }let(:first_option) { member_in_project.name }- it_behaves_like 'a select field'+ it_behaves_like "a select field"- describe 'with support for user groups' do+ describe "with support for user groups" dolet!(:group) do- create(:group, name: 'Group 1 in project',+ create(:group, name: "Group 1 in project",member_with_roles: { project => reader_role })end- it 'saves selected user group properly' do+ it "saves selected user group properly" docustom_field.custom_values.destroy_alloverview_page.visit_page@@ -392,13 +391,13 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- describe 'with support for placeholder users' do+ describe "with support for placeholder users" dolet!(:placeholder_user) do- create(:placeholder_user, name: 'Placeholder user',+ create(:placeholder_user, name: "Placeholder user",member_with_roles: { project => reader_role })end- it 'saves selected placeholer user properly' do+ it "saves selected placeholer user properly" docustom_field.custom_values.destroy_alloverview_page.visit_page@@ -418,12 +417,12 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- describe 'with multi select fields' do+ describe "with multi select fields" dolet(:section) { section_for_multi_select_fields }let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a autocomplete multi select field' do- it 'saves single selected values properly' do+ shared_examples "a autocomplete multi select field" do+ it "saves single selected values properly" docustom_field.custom_values.destroy_alloverview_page.visit_page@@ -444,7 +443,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'saves multi selected values properly' do+ it "saves multi selected values properly" docustom_field.custom_values.destroy_alloverview_page.visit_page@@ -468,7 +467,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'removes deselected values properly' do+ it "removes deselected values properly" dooverview_page.within_custom_field_container(custom_field) doexpect(page).to have_text first_optionexpect(page).to have_text second_option@@ -487,7 +486,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'does not remove values when not touching the init values' do+ it "does not remove values when not touching the init values" dooverview_page.within_custom_field_container(custom_field) doexpect(page).to have_text first_optionexpect(page).to have_text second_option@@ -507,7 +506,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'removes all values when clearing the input' do+ it "removes all values when clearing the input" dooverview_page.within_custom_field_container(custom_field) doexpect(page).to have_text first_optionexpect(page).to have_text second_option@@ -526,7 +525,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- it 'adds values properly to init values' do+ it "adds values properly to init values" docustom_field.custom_values.destroy_alloverview_page.visit_page@@ -562,46 +561,46 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- describe 'with multi select list CF' do+ describe "with multi select list CF" dolet(:custom_field) { multi_list_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }let(:first_option) { custom_field.custom_options.first.value }let(:second_option) { custom_field.custom_options.second.value }- it_behaves_like 'a autocomplete multi select field'+ it_behaves_like "a autocomplete multi select field"end- describe 'with multi version select list CF' do+ describe "with multi version select list CF" dolet(:custom_field) { multi_version_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }let(:first_option) { first_version.name }let(:second_option) { second_version.name }- it_behaves_like 'a autocomplete multi select field'+ it_behaves_like "a autocomplete multi select field"end- describe 'with multi user select list CF' do+ describe "with multi user select list CF" dolet(:custom_field) { multi_user_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }let(:first_option) { member_in_project.name }let(:second_option) { another_member_in_project.name }- it_behaves_like 'a autocomplete multi select field'+ it_behaves_like "a autocomplete multi select field"- describe 'with support for user groups' do+ describe "with support for user groups" dolet!(:group) do- create(:group, name: 'Group 1 in project',+ create(:group, name: "Group 1 in project",member_with_roles: { project => reader_role })endlet!(:another_group) do- create(:group, name: 'Group 2 in project',+ create(:group, name: "Group 2 in project",member_with_roles: { project => reader_role })end- it 'saves selected user groups properly' do+ it "saves selected user groups properly" docustom_field.custom_values.destroy_alloverview_page.visit_page@@ -621,17 +620,17 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendend- describe 'with support for placeholder users' do+ describe "with support for placeholder users" dolet!(:placeholder_user) do- create(:placeholder_user, name: 'Placeholder user',+ create(:placeholder_user, name: "Placeholder user",member_with_roles: { project => reader_role })endlet!(:another_placeholder_user) do- create(:placeholder_user, name: 'Another placeholder User',+ create(:placeholder_user, name: "Another placeholder User",member_with_roles: { project => reader_role })end- it 'shows only placeholder users from this project' do+ it "shows only placeholder users from this project" docustom_field.custom_values.destroy_alloverview_page.visit_pagediff --git a/spec/features/projects/project_custom_fields/overview_page/dialog/validation_spec.rb b/spec/features/projects/project_custom_fields/overview_page/dialog/validation_spec.rbindex 460d7253ddf..833cc8063f6 100644--- a/spec/features/projects/project_custom_fields/overview_page/dialog/validation_spec.rb+++ b/spec/features/projects/project_custom_fields/overview_page/dialog/validation_spec.rb@@ -26,11 +26,11 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'-require_relative '../shared_context'+require "spec_helper"+require_relative "../shared_context"-RSpec.describe 'Edit project custom fields on project overview page', :js do- include_context 'with seeded projects, members and project custom fields'+RSpec.describe "Edit project custom fields on project overview page", :js do+ include_context "with seeded projects, members and project custom fields"let(:overview_page) { Pages::Projects::Show.new(project) }@@ -39,12 +39,12 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dooverview_page.visit_pageend- describe 'with correct validation behaviour' do- describe 'after validation' do+ describe "with correct validation behaviour" do+ describe "after validation" dolet(:section) { section_for_input_fields }let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- it 'keeps showing only activated custom fields (tricky regression)' do+ it "keeps showing only activated custom fields (tricky regression)" docustom_field = string_project_custom_fieldcustom_field.update!(is_required: true)field = FormFields::Primerized::InputField.new(custom_field)@@ -54,38 +54,38 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dodialog.within_async_content docontainers = dialog.input_containers- expect(containers[0].text).to include('Boolean field')- expect(containers[1].text).to include('String field')- expect(containers[2].text).to include('Integer field')- expect(containers[3].text).to include('Float field')- expect(containers[4].text).to include('Date field')- expect(containers[5].text).to include('Text field')+ expect(containers[0].text).to include("Boolean field")+ expect(containers[1].text).to include("String field")+ expect(containers[2].text).to include("Integer field")+ expect(containers[3].text).to include("Float field")+ expect(containers[4].text).to include("Date field")+ expect(containers[5].text).to include("Text field")expect(page).to have_no_text(boolean_project_custom_field_activated_in_other_project.name)end- field.fill_in(with: '') # this will trigger the validation+ field.fill_in(with: "") # this will trigger the validationdialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.blank'))+ field.expect_error(I18n.t("activerecord.errors.messages.blank"))dialog.within_async_content docontainers = dialog.input_containers- expect(containers[0].text).to include('Boolean field')- expect(containers[1].text).to include('String field')- expect(containers[2].text).to include('Integer field')- expect(containers[3].text).to include('Float field')- expect(containers[4].text).to include('Date field')- expect(containers[5].text).to include('Text field')+ expect(containers[0].text).to include("Boolean field")+ expect(containers[1].text).to include("String field")+ expect(containers[2].text).to include("Integer field")+ expect(containers[3].text).to include("Float field")+ expect(containers[4].text).to include("Date field")+ expect(containers[5].text).to include("Text field")expect(page).to have_no_text(boolean_project_custom_field_activated_in_other_project.name)endend- describe 'does not loose the unpersisted values of the custom fields' do- context 'with input fields' do+ describe "does not loose the unpersisted values of the custom fields" do+ context "with input fields" dolet(:section) { section_for_input_fields }let(:invalid_custom_field) { string_project_custom_field }@@ -93,32 +93,32 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dolet(:invalid_field) { FormFields::Primerized::InputField.new(invalid_custom_field) }let(:valid_field) { FormFields::Primerized::InputField.new(valid_custom_field) }- it 'keeps the value' do+ it "keeps the value" doinvalid_custom_field.update!(is_required: true)overview_page.open_edit_dialog_for_section(section)- invalid_field.fill_in(with: '')- valid_field.fill_in(with: '123')+ invalid_field.fill_in(with: "")+ valid_field.fill_in(with: "123")dialog.submit- invalid_field.expect_error(I18n.t('activerecord.errors.messages.blank'))+ invalid_field.expect_error(I18n.t("activerecord.errors.messages.blank"))- invalid_field.expect_value('')- valid_field.expect_value('123')+ invalid_field.expect_value("")+ valid_field.expect_value("123")endend- context 'with select fields' do+ context "with select fields" dolet(:section) { section_for_select_fields }- context 'with version selected' do+ context "with version selected" dolet(:invalid_custom_field) { list_project_custom_field }let(:valid_custom_field) { version_project_custom_field }let(:invalid_field) { FormFields::Primerized::AutocompleteField.new(invalid_custom_field) }let(:valid_field) { FormFields::Primerized::AutocompleteField.new(valid_custom_field) }- it 'keeps the value' do+ it "keeps the value" doinvalid_custom_field.update!(is_required: true)overview_page.open_edit_dialog_for_section(section)@@ -127,20 +127,20 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dodialog.submit- invalid_field.expect_error(I18n.t('activerecord.errors.messages.blank'))+ invalid_field.expect_error(I18n.t("activerecord.errors.messages.blank"))invalid_field.expect_blankvalid_field.expect_selected(third_version.name)endend- context 'with user selected' do+ context "with user selected" dolet(:invalid_custom_field) { list_project_custom_field }let(:valid_custom_field) { user_project_custom_field }let(:invalid_field) { FormFields::Primerized::AutocompleteField.new(invalid_custom_field) }let(:valid_field) { FormFields::Primerized::AutocompleteField.new(valid_custom_field) }- it 'keeps the value' do+ it "keeps the value" doinvalid_custom_field.update!(is_required: true)overview_page.open_edit_dialog_for_section(section)@@ -149,46 +149,46 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dodialog.submit- invalid_field.expect_error(I18n.t('activerecord.errors.messages.blank'))+ invalid_field.expect_error(I18n.t("activerecord.errors.messages.blank"))invalid_field.expect_blankvalid_field.expect_selected(another_member_in_project.name)endend- context 'with list selected' do+ context "with list selected" dolet(:invalid_custom_field) { user_project_custom_field }let(:valid_custom_field) { list_project_custom_field }let(:invalid_field) { FormFields::Primerized::AutocompleteField.new(invalid_custom_field) }let(:valid_field) { FormFields::Primerized::AutocompleteField.new(valid_custom_field) }- it 'keeps the value' do+ it "keeps the value" doinvalid_custom_field.update!(is_required: true)overview_page.open_edit_dialog_for_section(section)invalid_field.clear- valid_field.select_option('Option 3')+ valid_field.select_option("Option 3")dialog.submit- invalid_field.expect_error(I18n.t('activerecord.errors.messages.blank'))+ invalid_field.expect_error(I18n.t("activerecord.errors.messages.blank"))invalid_field.expect_blank- valid_field.expect_selected('Option 3')+ valid_field.expect_selected("Option 3")endendend- context 'with multi select fields' do+ context "with multi select fields" dolet(:section) { section_for_multi_select_fields }- context 'with multi version selected' do+ context "with multi version selected" dolet(:invalid_custom_field) { multi_list_project_custom_field }let(:valid_custom_field) { multi_version_project_custom_field }let(:invalid_field) { FormFields::Primerized::AutocompleteField.new(invalid_custom_field) }let(:valid_field) { FormFields::Primerized::AutocompleteField.new(valid_custom_field) }- it 'keeps the values' do+ it "keeps the values" doinvalid_custom_field.update!(is_required: true)overview_page.open_edit_dialog_for_section(section)@@ -198,20 +198,20 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dodialog.submit- invalid_field.expect_error(I18n.t('activerecord.errors.messages.blank'))+ invalid_field.expect_error(I18n.t("activerecord.errors.messages.blank"))invalid_field.expect_blankvalid_field.expect_selected(first_version.name, third_version.name)endend- context 'with multi user selected' do+ context "with multi user selected" dolet(:invalid_custom_field) { multi_list_project_custom_field }let(:valid_custom_field) { multi_user_project_custom_field }let(:invalid_field) { FormFields::Primerized::AutocompleteField.new(invalid_custom_field) }let(:valid_field) { FormFields::Primerized::AutocompleteField.new(valid_custom_field) }- it 'keeps the values' do+ it "keeps the values" doinvalid_custom_field.update!(is_required: true)overview_page.open_edit_dialog_for_section(section)@@ -221,40 +221,40 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dodialog.submit- invalid_field.expect_error(I18n.t('activerecord.errors.messages.blank'))+ invalid_field.expect_error(I18n.t("activerecord.errors.messages.blank"))invalid_field.expect_blankvalid_field.expect_selected(member_in_project.name, one_more_member_in_project.name)endend- context 'with multi list selected' do+ context "with multi list selected" dolet(:invalid_custom_field) { multi_user_project_custom_field }let(:valid_custom_field) { multi_list_project_custom_field }let(:invalid_field) { FormFields::Primerized::AutocompleteField.new(invalid_custom_field) }let(:valid_field) { FormFields::Primerized::AutocompleteField.new(valid_custom_field) }- it 'keeps the value' do+ it "keeps the value" doinvalid_custom_field.update!(is_required: true)overview_page.open_edit_dialog_for_section(section)invalid_field.clearvalid_field.clear- valid_field.select_option('Option 1', 'Option 3')+ valid_field.select_option("Option 1", "Option 3")dialog.submit- invalid_field.expect_error(I18n.t('activerecord.errors.messages.blank'))+ invalid_field.expect_error(I18n.t("activerecord.errors.messages.blank"))invalid_field.expect_blank- valid_field.expect_selected('Option 1', 'Option 3')+ valid_field.expect_selected("Option 1", "Option 3")endendendendend- describe 'editing multiple sections' do+ describe "editing multiple sections" dolet(:input_fields_dialog) doComponents::Projects::ProjectCustomFields::EditDialog.new(project, section_for_input_fields)end@@ -263,7 +263,7 @@ RSpec.describe 'Edit project custom fields on project overview page', :js doendlet(:field) { FormFields::Primerized::AutocompleteField.new(list_project_custom_field) }- it 'displays validation errors, when the previous section modal was canceled (Regression)' do+ it "displays validation errors, when the previous section modal was canceled (Regression)" dolist_project_custom_field.update!(is_required: true)list_project_custom_field.custom_values.destroy_all@@ -272,16 +272,16 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dooverview_page.open_edit_dialog_for_section(section_for_select_fields)select_fields_dialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.blank'))+ field.expect_error(I18n.t("activerecord.errors.messages.blank"))endend- describe 'with input fields' do+ describe "with input fields" dolet(:section) { section_for_input_fields }let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a custom field input' do- it 'shows an error if the value is invalid' do+ shared_examples "a custom field input" do+ it "shows an error if the value is invalid" docustom_field.update!(is_required: true)custom_field.custom_values.destroy_all@@ -289,162 +289,54 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dodialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.blank'))+ field.expect_error(I18n.t("activerecord.errors.messages.blank"))endend# boolean CFs can not be validated- describe 'with string CF' do+ describe "with string CF" dolet(:custom_field) { string_project_custom_field }let(:field) { FormFields::Primerized::InputField.new(custom_field) }- it_behaves_like 'a custom field input'-- it 'shows an error if the value is too long' do- custom_field.update!(max_length: 3)-- overview_page.open_edit_dialog_for_section(section)-- field.fill_in(with: 'Foooo')-- dialog.submit-- field.expect_error(I18n.t('activerecord.errors.messages.too_long', count: 3))- end-- it 'shows an error if the value is too short' do- custom_field.update!(min_length: 3, max_length: 5)-- overview_page.open_edit_dialog_for_section(section)-- field.fill_in(with: 'Fo')-- dialog.submit-- field.expect_error(I18n.t('activerecord.errors.messages.too_short', count: 3))- end-- it 'shows an error if the value does not match the regex' do- custom_field.update!(regexp: '^[A-Z]+$')-- overview_page.open_edit_dialog_for_section(section)-- field.fill_in(with: 'foo')-- dialog.submit-- field.expect_error(I18n.t('activerecord.errors.messages.invalid'))- end+ it_behaves_like "a custom field input"end- describe 'with integer CF' do+ describe "with integer CF" dolet(:custom_field) { integer_project_custom_field }let(:field) { FormFields::Primerized::InputField.new(custom_field) }- it_behaves_like 'a custom field input'-- it 'shows an error if the value is too long' do- custom_field.update!(max_length: 2)-- overview_page.open_edit_dialog_for_section(section)-- field.fill_in(with: '111')-- dialog.submit-- field.expect_error(I18n.t('activerecord.errors.messages.too_long', count: 2))- end-- it 'shows an error if the value is too short' do- custom_field.update!(min_length: 2, max_length: 5)-- overview_page.open_edit_dialog_for_section(section)-- field.fill_in(with: '1')-- dialog.submit-- field.expect_error(I18n.t('activerecord.errors.messages.too_short', count: 2))- end+ it_behaves_like "a custom field input"end- describe 'with float CF' do+ describe "with float CF" dolet(:custom_field) { float_project_custom_field }let(:field) { FormFields::Primerized::InputField.new(custom_field) }- it_behaves_like 'a custom field input'-- it 'shows an error if the value is too long' do- custom_field.update!(max_length: 4)-- overview_page.open_edit_dialog_for_section(section)-- field.fill_in(with: '1111.1')-- dialog.submit-- field.expect_error(I18n.t('activerecord.errors.messages.too_long', count: 4))- end-- it 'shows an error if the value is too short' do- custom_field.update!(min_length: 4, max_length: 5)-- overview_page.open_edit_dialog_for_section(section)-- field.fill_in(with: '1.1')-- dialog.submit-- field.expect_error(I18n.t('activerecord.errors.messages.too_short', count: 4))- end+ it_behaves_like "a custom field input"end- describe 'with date CF' do+ describe "with date CF" dolet(:custom_field) { date_project_custom_field }let(:field) { FormFields::Primerized::InputField.new(custom_field) }- it_behaves_like 'a custom field input'+ it_behaves_like "a custom field input"end- describe 'with text CF' do+ describe "with text CF" dolet(:custom_field) { text_project_custom_field }let(:field) { FormFields::Primerized::EditorFormField.new(custom_field) }- it_behaves_like 'a custom field input'-- it 'shows an error if the value is too long' do- custom_field.update!(max_length: 3)-- overview_page.open_edit_dialog_for_section(section)-- field.set_value('Foooo')-- dialog.submit-- field.expect_error(I18n.t('activerecord.errors.messages.too_long', count: 3))- end-- it 'shows an error if the value is too short' do- custom_field.update!(min_length: 3, max_length: 5)-- overview_page.open_edit_dialog_for_section(section)-- field.set_value('Fo')-- dialog.submit-- field.expect_error(I18n.t('activerecord.errors.messages.too_short', count: 3))- end+ it_behaves_like "a custom field input"endend- describe 'with select fields' do+ describe "with select fields" dolet(:section) { section_for_select_fields }let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a custom field select' do- it 'shows an error if the value is invalid' do+ shared_examples "a custom field select" do+ it "shows an error if the value is invalid" docustom_field.update!(is_required: true)custom_field.custom_values.destroy_all@@ -452,38 +344,38 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dodialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.blank'))+ field.expect_error(I18n.t("activerecord.errors.messages.blank"))endend- describe 'with list CF' do+ describe "with list CF" dolet(:custom_field) { list_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- it_behaves_like 'a custom field select'+ it_behaves_like "a custom field select"end- describe 'with version CF' do+ describe "with version CF" dolet(:custom_field) { version_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- it_behaves_like 'a custom field select'+ it_behaves_like "a custom field select"end- describe 'with user CF' do+ describe "with user CF" dolet(:custom_field) { user_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- it_behaves_like 'a custom field select'+ it_behaves_like "a custom field select"endend- describe 'with multi select fields' do+ describe "with multi select fields" dolet(:section) { section_for_multi_select_fields }let(:dialog) { Components::Projects::ProjectCustomFields::EditDialog.new(project, section) }- shared_examples 'a custom field multi select' do- it 'shows an error if the value is invalid' do+ shared_examples "a custom field multi select" do+ it "shows an error if the value is invalid" docustom_field.update!(is_required: true)custom_field.custom_values.destroy_all@@ -491,29 +383,29 @@ RSpec.describe 'Edit project custom fields on project overview page', :js dodialog.submit- field.expect_error(I18n.t('activerecord.errors.messages.blank'))+ field.expect_error(I18n.t("activerecord.errors.messages.blank"))endend- describe 'with multi list CF' do+ describe "with multi list CF" dolet(:custom_field) { multi_list_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- it_behaves_like 'a custom field multi select'+ it_behaves_like "a custom field multi select"end- describe 'with multi version CF' do+ describe "with multi version CF" dolet(:custom_field) { multi_version_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- it_behaves_like 'a custom field multi select'+ it_behaves_like "a custom field multi select"end- describe 'with multi user CF' do+ describe "with multi user CF" dolet(:custom_field) { multi_user_project_custom_field }let(:field) { FormFields::Primerized::AutocompleteField.new(custom_field) }- it_behaves_like 'a custom field multi select'+ it_behaves_like "a custom field multi select"endendenddiff --git a/spec/features/projects/project_custom_fields/overview_page/sidebar_spec.rb b/spec/features/projects/project_custom_fields/overview_page/sidebar_spec.rbindex 50f01061ca2..4eae8b7909e 100644--- a/spec/features/projects/project_custom_fields/overview_page/sidebar_spec.rb+++ b/spec/features/projects/project_custom_fields/overview_page/sidebar_spec.rb@@ -26,11 +26,11 @@# See COPYRIGHT and LICENSE files for more details.#++-require 'spec_helper'-require_relative 'shared_context'+require "spec_helper"+require_relative "shared_context"-RSpec.describe 'Show project custom fields on project overview page', :js, :with_cuprite do- include_context 'with seeded projects, members and project custom fields'+RSpec.describe "Show project custom fields on project overview page", :js, :with_cuprite do+ include_context "with seeded projects, members and project custom fields"let(:overview_page) { Pages::Projects::Show.new(project) }@@ -38,191 +38,174 @@ RSpec.describe 'Show project custom fields on project overview page', :js, :withlogin_as adminend- it 'does show the project attributes sidebar' do+ it "does show the project attributes sidebar" dooverview_page.visit_page- within '.op-grid-page' do- expect(page).to have_css('#project-custom-fields-sidebar')+ within ".op-grid-page" do+ expect(page).to have_css("#project-custom-fields-sidebar")endend- describe 'with correct scoping' do- it 'shows enabled project custom fields in a sidebar grouped by section' do+ describe "with correct order and scoping" do+ it "shows the project custom field sections in the correct order" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar do- expect(page).to have_css('.op-project-custom-field-section-container', count: 3)+ sections = page.all(".op-project-custom-field-section-container")- overview_page.within_custom_field_section_container(section_for_input_fields) do- expect(page).to have_text 'Input fields'-- expect(page).to have_text 'Boolean field'- expect(page).to have_text 'String field'- expect(page).to have_text 'Integer field'- expect(page).to have_text 'Float field'- expect(page).to have_text 'Date field'- expect(page).to have_text 'Text field'- end-- overview_page.within_custom_field_section_container(section_for_select_fields) do- expect(page).to have_text 'Select fields'-- expect(page).to have_text 'List field'- expect(page).to have_text 'Version field'- expect(page).to have_text 'User field'- end-- overview_page.within_custom_field_section_container(section_for_multi_select_fields) do- expect(page).to have_text 'Multi select fields'+ expect(sections.size).to eq(3)- expect(page).to have_text 'Multi list field'- expect(page).to have_text 'Multi version field'- expect(page).to have_text 'Multi user field'- end+ expect(sections[0].text).to include("Input fields")+ expect(sections[1].text).to include("Select fields")+ expect(sections[2].text).to include("Multi select fields")end- end- it 'does not show project custom fields not enabled for this project in a sidebar' do- create(:string_project_custom_field, projects: [other_project], name: 'String field enabled for other project')+ section_for_input_fields.move_to_bottomoverview_page.visit_pageoverview_page.within_async_loaded_sidebar do- expect(page).to have_no_text 'String field enabled for other project'+ sections = page.all(".op-project-custom-field-section-container")++ expect(sections.size).to eq(3)++ expect(sections[0].text).to include("Select fields")+ expect(sections[1].text).to include("Multi select fields")+ expect(sections[2].text).to include("Input fields")endend- end- describe 'with correct order' do- it 'shows the project custom field sections in the correct order' do+ it "shows the project custom fields in the correct order within the sections" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar do- sections = page.all('.op-project-custom-field-section-container')+ overview_page.within_custom_field_section_container(section_for_input_fields) do+ fields = page.all(".op-project-custom-field-container")- expect(sections.size).to eq(3)+ expect(fields.size).to eq(6)- expect(sections[0].text).to include('Input fields')- expect(sections[1].text).to include('Select fields')- expect(sections[2].text).to include('Multi select fields')- end+ expect(fields[0].text).to include("Boolean field")+ expect(fields[1].text).to include("String field")+ expect(fields[2].text).to include("Integer field")+ expect(fields[3].text).to include("Float field")+ expect(fields[4].text).to include("Date field")+ expect(fields[5].text).to include("Text field")+ end- section_for_input_fields.move_to_bottom+ overview_page.within_custom_field_section_container(section_for_select_fields) do+ fields = page.all(".op-project-custom-field-container")- overview_page.visit_page+ expect(fields.size).to eq(3)- overview_page.within_async_loaded_sidebar do- sections = page.all('.op-project-custom-field-section-container')+ expect(fields[0].text).to include("List field")+ expect(fields[1].text).to include("Version field")+ expect(fields[2].text).to include("User field")+ end- expect(sections.size).to eq(3)+ overview_page.within_custom_field_section_container(section_for_multi_select_fields) do+ fields = page.all(".op-project-custom-field-container")- expect(sections[0].text).to include('Select fields')- expect(sections[1].text).to include('Multi select fields')- expect(sections[2].text).to include('Input fields')+ expect(fields.size).to eq(3)++ expect(fields[0].text).to include("Multi list field")+ expect(fields[1].text).to include("Multi version field")+ expect(fields[2].text).to include("Multi user field")+ endend- end- it 'shows the project custom fields in the correct order within the sections' do+ string_project_custom_field.move_to_bottom+overview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_section_container(section_for_input_fields) do- fields = page.all('.op-project-custom-field-container')+ fields = page.all(".op-project-custom-field-container")expect(fields.size).to eq(6)- expect(fields[0].text).to include('Boolean field')- expect(fields[1].text).to include('String field')- expect(fields[2].text).to include('Integer field')- expect(fields[3].text).to include('Float field')- expect(fields[4].text).to include('Date field')- expect(fields[5].text).to include('Text field')+ expect(fields[0].text).to include("Boolean field")+ expect(fields[1].text).to include("Integer field")+ expect(fields[2].text).to include("Float field")+ expect(fields[3].text).to include("Date field")+ expect(fields[4].text).to include("Text field")+ expect(fields[5].text).to include("String field")endend+ end- string_project_custom_field.move_to_bottom+ it "does not show project custom fields not enabled for this project in a sidebar" do+ create(:string_project_custom_field, projects: [other_project], name: "String field enabled for other project")overview_page.visit_pageoverview_page.within_async_loaded_sidebar do- overview_page.within_custom_field_section_container(section_for_input_fields) do- fields = page.all('.op-project-custom-field-container')-- expect(fields.size).to eq(6)-- expect(fields[0].text).to include('Boolean field')- expect(fields[1].text).to include('Integer field')- expect(fields[2].text).to include('Float field')- expect(fields[3].text).to include('Date field')- expect(fields[4].text).to include('Text field')- expect(fields[5].text).to include('String field')- end+ expect(page).to have_no_text "String field enabled for other project"endendend- describe 'with correct values' do- describe 'with boolean CF' do+ describe "with correct values" do+ describe "with boolean CF" do# it_behaves_like 'a project custom field' do# let(subject) { boolean_project_custom_field }# end- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do+ describe "with value set by user" do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(boolean_project_custom_field) do- expect(page).to have_text 'Boolean field'- expect(page).to have_text 'Yes'+ expect(page).to have_text "Boolean field"+ expect(page).to have_text "Yes"endendendend- describe 'with value unset by user' do+ describe "with value unset by user" do# A boolean cannot be completely unset via UI, only toggle between true and false, no blank value possiblebefore doboolean_project_custom_field.custom_values.where(customized: project).first.update!(value: false)end- it 'shows the correct value for the project custom field if given' do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(boolean_project_custom_field) do- expect(page).to have_text 'Boolean field'- expect(page).to have_text 'No'+ expect(page).to have_text "Boolean field"+ expect(page).to have_text "No"endendendend- describe 'with no value set by user' do+ describe "with no value set by user" dobefore doboolean_project_custom_field.custom_values.where(customized: project).destroy_allend- it 'shows an N/A text for the project custom field if no value given' do+ it "shows an N/A text for the project custom field if no value given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(boolean_project_custom_field) do- expect(page).to have_text 'Boolean field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Boolean field"+ expect(page).to have_text I18n.t("placeholders.default")endendend- it 'does not show the default value for the project custom field if no value given' do+ it "does not show the default value for the project custom field if no value given" doboolean_project_custom_field.update!(default_value: true)overview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(boolean_project_custom_field) do- expect(page).to have_text 'Boolean field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Boolean field"+ expect(page).to have_text I18n.t("placeholders.default")endend@@ -232,295 +215,295 @@ RSpec.describe 'Show project custom fields on project overview page', :js, :withoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(boolean_project_custom_field) do- expect(page).to have_text 'Boolean field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Boolean field"+ expect(page).to have_text I18n.t("placeholders.default")endendendendend- describe 'with string CF' do- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do+ describe "with string CF" do+ describe "with value set by user" do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(string_project_custom_field) do- expect(page).to have_text 'String field'- expect(page).to have_text 'Foo'+ expect(page).to have_text "String field"+ expect(page).to have_text "Foo"endendendend- describe 'with value unset by user' do+ describe "with value unset by user" dobefore do- string_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ string_project_custom_field.custom_values.where(customized: project).first.update!(value: "")end- it 'shows the correct value for the project custom field if given' do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(string_project_custom_field) do- expect(page).to have_text 'String field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "String field"+ expect(page).to have_text I18n.t("placeholders.default")endendendend- describe 'with no value set by user' do+ describe "with no value set by user" dobefore dostring_project_custom_field.custom_values.where(customized: project).destroy_allend- it 'shows an N/A text for the project custom field if no value given' do+ it "shows an N/A text for the project custom field if no value given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(string_project_custom_field) do- expect(page).to have_text 'String field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "String field"+ expect(page).to have_text I18n.t("placeholders.default")endendend- it 'does not show the default value for the project custom field if no value given' do- string_project_custom_field.update!(default_value: 'Bar')+ it "does not show the default value for the project custom field if no value given" do+ string_project_custom_field.update!(default_value: "Bar")overview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(string_project_custom_field) do- expect(page).to have_text 'String field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "String field"+ expect(page).to have_text I18n.t("placeholders.default")endendendendend- describe 'with integer CF' do- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do+ describe "with integer CF" do+ describe "with value set by user" do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(integer_project_custom_field) do- expect(page).to have_text 'Integer field'- expect(page).to have_text '123'+ expect(page).to have_text "Integer field"+ expect(page).to have_text "123"endendendend- describe 'with value unset by user' do+ describe "with value unset by user" dobefore do- integer_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ integer_project_custom_field.custom_values.where(customized: project).first.update!(value: "")end- it 'shows the correct value for the project custom field if given' do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(integer_project_custom_field) do- expect(page).to have_text 'Integer field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Integer field"+ expect(page).to have_text I18n.t("placeholders.default")endendendend- describe 'with no value set by user' do+ describe "with no value set by user" dobefore dointeger_project_custom_field.custom_values.where(customized: project).destroy_allend- it 'shows an N/A text for the project custom field if no value given' do+ it "shows an N/A text for the project custom field if no value given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(integer_project_custom_field) do- expect(page).to have_text 'Integer field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Integer field"+ expect(page).to have_text I18n.t("placeholders.default")endendend- it 'does not show the default value for the project custom field if no value given' do+ it "does not show the default value for the project custom field if no value given" dointeger_project_custom_field.update!(default_value: 456)overview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(integer_project_custom_field) do- expect(page).to have_text 'Integer field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Integer field"+ expect(page).to have_text I18n.t("placeholders.default")endendendendend- describe 'with date CF' do- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do+ describe "with date CF" do+ describe "with value set by user" do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(date_project_custom_field) do- expect(page).to have_text 'Date field'- expect(page).to have_text '01/01/2024'+ expect(page).to have_text "Date field"+ expect(page).to have_text "01/01/2024"endendendend- describe 'with value unset by user' do+ describe "with value unset by user" dobefore do- date_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ date_project_custom_field.custom_values.where(customized: project).first.update!(value: "")end- it 'shows the correct value for the project custom field if given' do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(date_project_custom_field) do- expect(page).to have_text 'Date field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Date field"+ expect(page).to have_text I18n.t("placeholders.default")endendendend- describe 'with no value set by user' do+ describe "with no value set by user" dobefore dodate_project_custom_field.custom_values.where(customized: project).destroy_allend- it 'shows an N/A text for the project custom field if no value given' do+ it "shows an N/A text for the project custom field if no value given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(date_project_custom_field) do- expect(page).to have_text 'Date field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Date field"+ expect(page).to have_text I18n.t("placeholders.default")endendend- it 'does not show the default value for the project custom field if no value given' do+ it "does not show the default value for the project custom field if no value given" dodate_project_custom_field.update!(default_value: Date.new(2024, 2, 2))overview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(date_project_custom_field) do- expect(page).to have_text 'Date field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Date field"+ expect(page).to have_text I18n.t("placeholders.default")endendendendend- describe 'with float CF' do- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do+ describe "with float CF" do+ describe "with value set by user" do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(float_project_custom_field) do- expect(page).to have_text 'Float field'- expect(page).to have_text '123.456'+ expect(page).to have_text "Float field"+ expect(page).to have_text "123.456"endendendend- describe 'with value unset by user' do+ describe "with value unset by user" dobefore do- float_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ float_project_custom_field.custom_values.where(customized: project).first.update!(value: "")end- it 'shows the correct value for the project custom field if given' do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(float_project_custom_field) do- expect(page).to have_text 'Float field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Float field"+ expect(page).to have_text I18n.t("placeholders.default")endendendend- describe 'with no value set by user' do+ describe "with no value set by user" dobefore dofloat_project_custom_field.custom_values.where(customized: project).destroy_allend- it 'shows an N/A text for the project custom field if no value given' do+ it "shows an N/A text for the project custom field if no value given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(float_project_custom_field) do- expect(page).to have_text 'Float field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Float field"+ expect(page).to have_text I18n.t("placeholders.default")endendend- it 'dies not show the default value for the project custom field if no value given' do+ it "dies not show the default value for the project custom field if no value given" dofloat_project_custom_field.update!(default_value: 456.789)overview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(float_project_custom_field) do- expect(page).to have_text 'Float field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Float field"+ expect(page).to have_text I18n.t("placeholders.default")endendendendend- describe 'with text CF' do- describe 'with value set by user' do- context 'with a value that is shorter than 100 characters' do- it 'shows the correct value for the project custom field if given without truncation and dialog button' do+ describe "with text CF" do+ describe "with value set by user" do+ context "with a value that is shorter than 100 characters" do+ it "shows the correct value for the project custom field if given without truncation and dialog button" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(text_project_custom_field) do- expect(page).to have_text 'Text field'+ expect(page).to have_text "Text field"expect(page).to have_text "Lorem\nipsum"endendendend- context 'with a value that is longer than 100 characters' do+ context "with a value that is longer than 100 characters" dobefore do- text_project_custom_field.custom_values.where(customized: project).first.update!(value: 'a' * 101)+ text_project_custom_field.custom_values.where(customized: project).first.update!(value: "a" * 101)end- it 'shows the correct value for the project custom field if given with truncation and dialog button' do+ it "shows the correct value for the project custom field if given with truncation and dialog button" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(text_project_custom_field) do- expect(page).to have_text 'Text field'+ expect(page).to have_text "Text field"expect(page).to have_text ("#{'a' * 97}...")- expect(page).to have_text 'Expand'+ expect(page).to have_text "Expand"- click_on 'Expand'+ click_on "Expand"- within 'dialog' do- expect(page).to have_text 'a' * 101+ within "dialog" do+ expect(page).to have_text "a" * 101endendend@@ -528,254 +511,254 @@ RSpec.describe 'Show project custom fields on project overview page', :js, :withendend- describe 'with value unset by user' do+ describe "with value unset by user" dobefore do- text_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ text_project_custom_field.custom_values.where(customized: project).first.update!(value: "")end- it 'shows the correct value for the project custom field if given' do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(text_project_custom_field) do- expect(page).to have_text 'Text field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Text field"+ expect(page).to have_text I18n.t("placeholders.default")endendendend- describe 'with no value set by user' do+ describe "with no value set by user" dobefore dotext_project_custom_field.custom_values.where(customized: project).destroy_allend- it 'shows an N/A text for the project custom field if no value given' do+ it "shows an N/A text for the project custom field if no value given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(text_project_custom_field) do- expect(page).to have_text 'Text field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Text field"+ expect(page).to have_text I18n.t("placeholders.default")endendend- it 'does not show the default value for the project custom field if no value given' do- text_project_custom_field.update!(default_value: 'Dolor sit amet')+ it "does not show the default value for the project custom field if no value given" do+ text_project_custom_field.update!(default_value: "Dolor sit amet")overview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(text_project_custom_field) do- expect(page).to have_text 'Text field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Text field"+ expect(page).to have_text I18n.t("placeholders.default")endendendendend- describe 'with list CF' do- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do+ describe "with list CF" do+ describe "with value set by user" do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(list_project_custom_field) do- expect(page).to have_text 'List field'- expect(page).to have_text 'Option 1'+ expect(page).to have_text "List field"+ expect(page).to have_text "Option 1"endendendend- describe 'with value unset by user' do+ describe "with value unset by user" dobefore do- list_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ list_project_custom_field.custom_values.where(customized: project).first.update!(value: "")end- it 'shows the correct value for the project custom field if given' do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(list_project_custom_field) do- expect(page).to have_text 'List field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "List field"+ expect(page).to have_text I18n.t("placeholders.default")endendendend- describe 'with no value set by user' do+ describe "with no value set by user" dobefore dolist_project_custom_field.custom_values.where(customized: project).destroy_allend- it 'shows an N/A text for the project custom field if no value given' do+ it "shows an N/A text for the project custom field if no value given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(list_project_custom_field) do- expect(page).to have_text 'List field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "List field"+ expect(page).to have_text I18n.t("placeholders.default")endendend- it 'does not show the default value for the project custom field if no value given' do+ it "does not show the default value for the project custom field if no value given" dolist_project_custom_field.custom_options.first.update!(default_value: true)overview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(list_project_custom_field) do- expect(page).to have_text 'List field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "List field"+ expect(page).to have_text I18n.t("placeholders.default")endendendendend- describe 'with version CF' do- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do+ describe "with version CF" do+ describe "with value set by user" do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(version_project_custom_field) do- expect(page).to have_text 'Version field'- expect(page).to have_text 'Version 1'+ expect(page).to have_text "Version field"+ expect(page).to have_text "Version 1"endendendend- describe 'with value unset by user' do+ describe "with value unset by user" dobefore do- version_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ version_project_custom_field.custom_values.where(customized: project).first.update!(value: "")end- it 'shows the correct value for the project custom field if given' do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(version_project_custom_field) do- expect(page).to have_text 'Version field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Version field"+ expect(page).to have_text I18n.t("placeholders.default")endendendend- describe 'with no value set by user' do+ describe "with no value set by user" dobefore doversion_project_custom_field.custom_values.where(customized: project).destroy_allend- it 'shows an N/A text for the project custom field if no value given' do+ it "shows an N/A text for the project custom field if no value given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(version_project_custom_field) do- expect(page).to have_text 'Version field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Version field"+ expect(page).to have_text I18n.t("placeholders.default")endendendendend- describe 'with user CF' do- describe 'with value set by user' do- it 'shows the correct value for the project custom field if given' do+ describe "with user CF" do+ describe "with value set by user" do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(user_project_custom_field) do- expect(page).to have_text 'User field'- expect(page).to have_css('opce-principal')- expect(page).to have_text 'Member 1 In Project'+ expect(page).to have_text "User field"+ expect(page).to have_css("opce-principal")+ expect(page).to have_text "Member 1 In Project"endendendend- describe 'with value unset by user' do+ describe "with value unset by user" dobefore do- user_project_custom_field.custom_values.where(customized: project).first.update!(value: '')+ user_project_custom_field.custom_values.where(customized: project).first.update!(value: "")end- it 'shows the correct value for the project custom field if given' do+ it "shows the correct value for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(user_project_custom_field) do- expect(page).to have_text 'User field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "User field"+ expect(page).to have_text I18n.t("placeholders.default")endendendend- describe 'with no value set by user' do+ describe "with no value set by user" dobefore douser_project_custom_field.custom_values.where(customized: project).destroy_allend- it 'shows an N/A text for the project custom field if no value given' do+ it "shows an N/A text for the project custom field if no value given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(user_project_custom_field) do- expect(page).to have_text 'User field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "User field"+ expect(page).to have_text I18n.t("placeholders.default")endendendend- describe 'with support for user groups' do+ describe "with support for user groups" do# TODOend- describe 'with support for user placeholders' do+ describe "with support for user placeholders" do# TODOendend- describe 'with multi list CF' do- describe 'with value set by user' do- it 'shows the correct values for the project custom field if given' do+ describe "with multi list CF" do+ describe "with value set by user" do+ it "shows the correct values for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(multi_list_project_custom_field) do- expect(page).to have_text 'Multi list field'- expect(page).to have_text 'Option 1, Option 2'+ expect(page).to have_text "Multi list field"+ expect(page).to have_text "Option 1, Option 2"endendendend- describe 'with no value set by user' do+ describe "with no value set by user" dobefore domulti_list_project_custom_field.custom_values.where(customized: project).destroy_allend- it 'shows an N/A text for the project custom field if no value given' do+ it "shows an N/A text for the project custom field if no value given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(multi_list_project_custom_field) do- expect(page).to have_text 'Multi list field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Multi list field"+ expect(page).to have_text I18n.t("placeholders.default")endendend- it 'does not show the default value(s) for the project custom field if no value given' do+ it "does not show the default value(s) for the project custom field if no value given" domulti_list_project_custom_field.custom_options.first.update!(default_value: true)multi_list_project_custom_field.custom_options.second.update!(default_value: true)@@ -783,74 +766,74 @@ RSpec.describe 'Show project custom fields on project overview page', :js, :withoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(multi_list_project_custom_field) do- expect(page).to have_text 'Multi list field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Multi list field"+ expect(page).to have_text I18n.t("placeholders.default")endendendendend- describe 'with multi version CF' do- describe 'with value set by user' do- it 'shows the correct values for the project custom field if given' do+ describe "with multi version CF" do+ describe "with value set by user" do+ it "shows the correct values for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(multi_version_project_custom_field) do- expect(page).to have_text 'Multi version field'- expect(page).to have_text 'Version 1, Version 2'+ expect(page).to have_text "Multi version field"+ expect(page).to have_text "Version 1, Version 2"endendendend- describe 'with no value set by user' do+ describe "with no value set by user" dobefore domulti_version_project_custom_field.custom_values.where(customized: project).destroy_allend- it 'shows an N/A text for the project custom field if no value given' do+ it "shows an N/A text for the project custom field if no value given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(multi_version_project_custom_field) do- expect(page).to have_text 'Multi version field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Multi version field"+ expect(page).to have_text I18n.t("placeholders.default")endendendendend- describe 'with multi user CF' do- describe 'with value set by user' do- it 'shows the correct values for the project custom field if given' do+ describe "with multi user CF" do+ describe "with value set by user" do+ it "shows the correct values for the project custom field if given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(multi_user_project_custom_field) do- expect(page).to have_text 'Multi user field'- expect(page).to have_css 'opce-principal', count: 2- expect(page).to have_text 'Member 1 In Project'- expect(page).to have_text 'Member 2 In Project'+ expect(page).to have_text "Multi user field"+ expect(page).to have_css "opce-principal", count: 2+ expect(page).to have_text "Member 1 In Project"+ expect(page).to have_text "Member 2 In Project"endendendend- describe 'with no value set by user' do+ describe "with no value set by user" dobefore domulti_user_project_custom_field.custom_values.where(customized: project).destroy_allend- it 'shows an N/A text for the project custom field if no value given' do+ it "shows an N/A text for the project custom field if no value given" dooverview_page.visit_pageoverview_page.within_async_loaded_sidebar dooverview_page.within_custom_field_container(multi_user_project_custom_field) do- expect(page).to have_text 'Multi user field'- expect(page).to have_text I18n.t('placeholders.default')+ expect(page).to have_text "Multi user field"+ expect(page).to have_text I18n.t("placeholders.default")endendenddiff --git a/spec/models/projects/customizable_spec.rb b/spec/models/projects/customizable_spec.rbindex 0c7a83d16be..6dc4d64fe22 100644--- a/spec/models/projects/customizable_spec.rb+++ b/spec/models/projects/customizable_spec.rb@@ -96,7 +96,6 @@ RSpec.describe Project, "customizable" docontext "when custom fields are mapped to this project" dobefore doproject.project_custom_fields << [text_custom_field, bool_custom_field]- project.reload # TODO: why is this necessary?endit "#custom_field_values returns a hash of mapped custom fields with nil values" do