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
Update specs
Dombi Attila82d492a2d70f
diff --git a/app/contracts/custom_fields/base_contract.rb b/app/contracts/custom_fields/base_contract.rbindex 42d7ff8ff48..6648bfc213b 100644--- a/app/contracts/custom_fields/base_contract.rb+++ b/app/contracts/custom_fields/base_contract.rb@@ -42,7 +42,7 @@ module CustomFieldsattribute :possible_valuesattribute :regexpattribute :searchable- attribute :visible+ attribute :admin_onlyattribute :default_valueattribute :possible_valuesattribute :multi_valuediff --git a/spec/components/users/profile/attributes_component_spec.rb b/spec/components/users/profile/attributes_component_spec.rbindex d58d6ca87f3..54e81d95e59 100644--- a/spec/components/users/profile/attributes_component_spec.rb+++ b/spec/components/users/profile/attributes_component_spec.rb@@ -63,7 +63,7 @@ RSpec.describe Users::Profile::AttributesComponent, type: :component doendcontext "when user has a non-visible custom field with a present value" do- let(:custom_field) { create(:user_custom_field, :string, visible: false) }+ let(:custom_field) { create(:user_custom_field, :string, admin_only: true) }let(:user) { build(:user, custom_values: [build(:custom_value, custom_field:, value: "Hello")]) }it { is_expected.to be(false) }@@ -71,11 +71,11 @@ RSpec.describe Users::Profile::AttributesComponent, type: :component doenddescribe "Custom field" do- let(:custom_field) { create(:user_custom_field, :string, visible:) }+ let(:custom_field) { create(:user_custom_field, :string, admin_only:) }let(:custom_values) do[build(:custom_value, custom_field:, value: "Hello custom field")]end- let(:visible) { true }+ let(:admin_only) { false }let(:user) { build_stubbed(:user, custom_values:) }current_user { build(:admin) }@@ -89,7 +89,7 @@ RSpec.describe Users::Profile::AttributesComponent, type: :component doendcontext "when not visible" do- let(:visible) { false }+ let(:admin_only) { true }it "does not render the field" doexpect(page).to have_no_text("Hello custom field")@@ -97,8 +97,8 @@ RSpec.describe Users::Profile::AttributesComponent, type: :component doendcontext "with multiple custom fields" do- let(:list_custom_field) { create(:user_custom_field, :multi_list, visible:, name: "Ze list") }- let(:text_custom_field) { create(:user_custom_field, :text, visible:, name: "A portrait") }+ let(:list_custom_field) { create(:user_custom_field, :multi_list, admin_only:, name: "Ze list") }+ let(:text_custom_field) { create(:user_custom_field, :text, admin_only:, name: "A portrait") }let(:custom_values) do[build(:custom_value, custom_field: list_custom_field, value: list_custom_field.possible_values[0]),diff --git a/spec/contracts/project_custom_field_project_mappings/base_contract_spec.rb b/spec/contracts/project_custom_field_project_mappings/base_contract_spec.rbindex 67dd21a7b1b..d50157db756 100644--- a/spec/contracts/project_custom_field_project_mappings/base_contract_spec.rb+++ b/spec/contracts/project_custom_field_project_mappings/base_contract_spec.rb@@ -49,7 +49,7 @@ RSpec.describe ProjectCustomFieldProjectMappings::BaseContract doendcontext "with non-visible custom field and admin user" do- let(:project_custom_field) { build_stubbed(:project_custom_field, visible: false) }+ let(:project_custom_field) { build_stubbed(:project_custom_field, admin_only: true) }before doallow(ProjectCustomField).to receive(:all).and_return([project_custom_field])@@ -60,7 +60,7 @@ RSpec.describe ProjectCustomFieldProjectMappings::BaseContract docontext "with non-visible custom field and non-admin user" dolet(:user) { build_stubbed(:user) }- let(:project_custom_field) { build_stubbed(:project_custom_field, visible: false) }+ let(:project_custom_field) { build_stubbed(:project_custom_field, admin_only: true) }before doallow(ProjectCustomField).to receive(:visible).and_return([project_custom_field])diff --git a/spec/contracts/projects/shared_contract_examples.rb b/spec/contracts/projects/shared_contract_examples.rbindex 8884872a583..a765a3727c1 100644--- a/spec/contracts/projects/shared_contract_examples.rb+++ b/spec/contracts/projects/shared_contract_examples.rb@@ -269,8 +269,8 @@ RSpec.shared_examples_for "project contract" doenddescribe "available_custom_fields" do- let(:visible_custom_field) { build_stubbed(:integer_project_custom_field, visible: true) }- let(:invisible_custom_field) { build_stubbed(:integer_project_custom_field, visible: false) }+ let(:visible_custom_field) { build_stubbed(:integer_project_custom_field, admin_only: false) }+ let(:invisible_custom_field) { build_stubbed(:integer_project_custom_field, admin_only: true) }before doallow(project)diff --git a/spec/features/projects/copy_spec.rb b/spec/features/projects/copy_spec.rbindex 161f10519d2..18253e9452a 100644--- a/spec/features/projects/copy_spec.rb+++ b/spec/features/projects/copy_spec.rb@@ -293,7 +293,7 @@ RSpec.describe "Projects copy", :js, :with_cuprite,context "with correct handling of invisible values" dolet!(:invisible_field) docreate(:string_project_custom_field, name: "Text for Admins only",- visible: false,+ admin_only: true,project_custom_field_section:,projects: [project])enddiff --git a/spec/features/projects/create_spec.rb b/spec/features/projects/create_spec.rbindex 8f95c1a2c7f..c58f3f88f84 100644--- a/spec/features/projects/create_spec.rb+++ b/spec/features/projects/create_spec.rb@@ -339,7 +339,7 @@ RSpec.describe "Projects", "creation",context "with correct handling of invisible values" dolet!(:invisible_field) docreate(:string_project_custom_field, name: "Text for Admins only",- visible: false,+ admin_only: true,project_custom_field_section:)enddiff --git a/spec/features/projects/persisted_lists_spec.rb b/spec/features/projects/persisted_lists_spec.rbindex 310e967f41a..c7fad929373 100644--- a/spec/features/projects/persisted_lists_spec.rb+++ b/spec/features/projects/persisted_lists_spec.rb@@ -38,7 +38,7 @@ RSpec.describe "Persisted lists on projects index page",shared_let(:developer) { create(:project_role, name: "Developer") }shared_let(:custom_field) { create(:text_project_custom_field) }- shared_let(:invisible_custom_field) { create(:project_custom_field, visible: false) }+ shared_let(:invisible_custom_field) { create(:project_custom_field, admin_only: true) }shared_let(:project) docreate(:project,diff --git a/spec/features/projects/project_custom_fields/overview_page/dialog/render_spec.rb b/spec/features/projects/project_custom_fields/overview_page/dialog/render_spec.rbindex d1f503a8479..15ca249574e 100644--- a/spec/features/projects/project_custom_fields/overview_page/dialog/render_spec.rb+++ b/spec/features/projects/project_custom_fields/overview_page/dialog/render_spec.rb@@ -148,7 +148,7 @@ RSpec.describe "Edit project custom fields on project overview page", :js dolet!(:visible_project_custom_field) docreate(:project_custom_field,name: "Normal field",- visible: true,+ admin_only: false,projects: [project],project_custom_field_section: section_with_invisible_fields)end@@ -156,7 +156,7 @@ RSpec.describe "Edit project custom fields on project overview page", :js dolet!(:invisible_project_custom_field) docreate(:project_custom_field,name: "Admin only field",- visible: false,+ admin_only: true,projects: [project],project_custom_field_section: section_with_invisible_fields)enddiff --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 4c8779341bc..9c82c049bdb 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@@ -659,7 +659,7 @@ RSpec.describe "Edit project custom fields on project overview page", :js dolet(:field) { FormFields::Primerized::InputField.new(custom_field) }before do- all_fields.without(string_project_custom_field).each { |cf| cf.update(visible: false) }+ all_fields.without(string_project_custom_field).each { |cf| cf.update(admin_only: true) }endit "does not clears them after a project admin updates" dodiff --git a/spec/features/projects/project_custom_fields/settings/mapping_spec.rb b/spec/features/projects/project_custom_fields/settings/mapping_spec.rbindex edd7b66e49a..f94c13871ee 100644--- a/spec/features/projects/project_custom_fields/settings/mapping_spec.rb+++ b/spec/features/projects/project_custom_fields/settings/mapping_spec.rb@@ -332,7 +332,7 @@ RSpec.describe "Projects custom fields mapping via project settings", :js, :withlet!(:visible_project_custom_field) docreate(:project_custom_field,name: "Normal field",- visible: true,+ admin_only: false,projects: [project],project_custom_field_section: section_with_invisible_fields)end@@ -340,7 +340,7 @@ RSpec.describe "Projects custom fields mapping via project settings", :js, :withlet!(:invisible_project_custom_field) docreate(:project_custom_field,name: "Admin only field",- visible: false,+ admin_only: true,projects: [project],project_custom_field_section: section_with_invisible_fields)enddiff --git a/spec/features/projects/projects_index_spec.rb b/spec/features/projects/projects_index_spec.rbindex dbc95b6f7a6..181468bf93f 100644--- a/spec/features/projects/projects_index_spec.rb+++ b/spec/features/projects/projects_index_spec.rb@@ -35,7 +35,7 @@ RSpec.describe "Projects index page", :js, :with_cuprite, with_settings: { loginshared_let(:developer) { create(:project_role, name: "Developer") }shared_let(:custom_field) { create(:text_project_custom_field) }- shared_let(:invisible_custom_field) { create(:project_custom_field, visible: false) }+ shared_let(:invisible_custom_field) { create(:project_custom_field, admin_only: true) }shared_let(:project) { create(:project, name: "Plain project", identifier: "plain-project") }shared_let(:public_project) dodiff --git a/spec/lib/api/v3/projects/project_representer_rendering_spec.rb b/spec/lib/api/v3/projects/project_representer_rendering_spec.rbindex f8f1bebc6b0..9220dd8f698 100644--- a/spec/lib/api/v3/projects/project_representer_rendering_spec.rb+++ b/spec/lib/api/v3/projects/project_representer_rendering_spec.rb@@ -53,8 +53,8 @@ RSpec.describe API::V3::Projects::ProjectRepresenter, "rendering" doendend- let(:int_custom_field) { build_stubbed(:integer_project_custom_field, visible: false) }- let(:version_custom_field) { build_stubbed(:version_project_custom_field, visible: true) }+ let(:int_custom_field) { build_stubbed(:integer_project_custom_field, admin_only: true) }+ let(:version_custom_field) { build_stubbed(:version_project_custom_field, admin_only: false) }let(:int_custom_value) doCustomValue.new(custom_field: int_custom_field,value: "1234",@@ -164,7 +164,7 @@ RSpec.describe API::V3::Projects::ProjectRepresenter, "rendering" docontext "if the user is no admin and the field is visible" dobefore do- int_custom_field.visible = true+ int_custom_field.admin_only = falseendit "has a property for the int custom field" do@@ -177,7 +177,7 @@ RSpec.describe API::V3::Projects::ProjectRepresenter, "rendering" dolet(:permissions) { [] }before do- int_custom_field.visible = true+ int_custom_field.admin_only = falseendit "has no property for the int custom field" do@@ -512,7 +512,7 @@ RSpec.describe API::V3::Projects::ProjectRepresenter, "rendering" do.to receive(:admin?).and_return(true)- version_custom_field.visible = false+ version_custom_field.admin_only = trueendit "links custom fields" do@@ -523,7 +523,7 @@ RSpec.describe API::V3::Projects::ProjectRepresenter, "rendering" docontext "if the user is no admin and the field is invisible" dobefore do- version_custom_field.visible = false+ version_custom_field.admin_only = trueendit "does not link the custom field" dodiff --git a/spec/models/project_custom_field_spec.rb b/spec/models/project_custom_field_spec.rbindex 7e9858f9bb6..966fb094054 100644--- a/spec/models/project_custom_field_spec.rb+++ b/spec/models/project_custom_field_spec.rb@@ -103,7 +103,7 @@ RSpec.describe ProjectCustomField doenddescribe ".visible" do- shared_let(:invisible_cf) { create(:string_project_custom_field, visible: false) }+ shared_let(:invisible_cf) { create(:string_project_custom_field, admin_only: true) }shared_let(:other_cf) { create(:string_project_custom_field) }shared_let(:project_cf) { create(:string_project_custom_field) }shared_let(:public_cf) { create(:string_project_custom_field) }diff --git a/spec/models/projects/exporter/exportable_project_context.rb b/spec/models/projects/exporter/exportable_project_context.rbindex 94e7835096c..339491e5784 100644--- a/spec/models/projects/exporter/exportable_project_context.rb+++ b/spec/models/projects/exporter/exportable_project_context.rb@@ -35,7 +35,7 @@ RSpec.shared_context "with a project with an arrangement of custom fields" doshared_let(:text_cf) { create(:text_project_custom_field, position: 6) }shared_let(:string_cf) { create(:string_project_custom_field, position: 7) }shared_let(:date_cf) { create(:date_project_custom_field, position: 8) }- shared_let(:hidden_cf) { create(:string_project_custom_field, position: 9, visible: false) }+ shared_let(:hidden_cf) { create(:string_project_custom_field, position: 9, admin_only: true) }let!(:not_used_string_cf) { create(:string_project_custom_field, position: 10) }diff --git a/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb b/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rbindex 528c5cd77a8..d73b936f128 100644--- a/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb+++ b/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb@@ -46,7 +46,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf dolet(:project_custom_field_string) docreate(:project_custom_field, :string,name: "Secret string", default_value: "admin eyes only",- visible: false)+ admin_only: true)endlet(:project_custom_field_long_text) docreate(:project_custom_field, :text,diff --git a/spec/requests/api/v3/projects/create_resource_spec.rb b/spec/requests/api/v3/projects/create_resource_spec.rbindex f48f88354f0..fdfb2873965 100644--- a/spec/requests/api/v3/projects/create_resource_spec.rb+++ b/spec/requests/api/v3/projects/create_resource_spec.rb@@ -37,7 +37,7 @@ RSpec.describe "API v3 Project resource create", content_type: :json docreate(:text_project_custom_field)endlet(:invisible_custom_field) do- create(:text_project_custom_field, visible: false)+ create(:text_project_custom_field, admin_only: true)endlet(:custom_value) doCustomValue.create(custom_field:,diff --git a/spec/requests/api/v3/projects/show_resource_spec.rb b/spec/requests/api/v3/projects/show_resource_spec.rbindex 7cbb790b561..6bf1204d012 100644--- a/spec/requests/api/v3/projects/show_resource_spec.rb+++ b/spec/requests/api/v3/projects/show_resource_spec.rb@@ -55,7 +55,7 @@ RSpec.describe "API v3 Project resource show", content_type: :json docustomized: project)endlet(:invisible_custom_field) do- create(:text_project_custom_field, visible: false)+ create(:text_project_custom_field, admin_only: true)endlet(:invisible_custom_value) doCustomValue.create(custom_field: invisible_custom_field,diff --git a/spec/requests/api/v3/projects/update_resource_spec.rb b/spec/requests/api/v3/projects/update_resource_spec.rbindex c24c769d1e8..756c01a5463 100644--- a/spec/requests/api/v3/projects/update_resource_spec.rb+++ b/spec/requests/api/v3/projects/update_resource_spec.rb@@ -45,7 +45,7 @@ RSpec.describe "API v3 Project resource update", content_type: :json docreate(:text_project_custom_field)endlet(:invisible_custom_field) do- create(:text_project_custom_field, visible: false)+ create(:text_project_custom_field, admin_only: true)endlet(:permissions) { %i[edit_project view_project_attributes edit_project_attributes] }let(:path) { api_v3_paths.project(project.id) }diff --git a/spec/services/project_custom_field_project_mappings/bulk_update_service_spec.rb b/spec/services/project_custom_field_project_mappings/bulk_update_service_spec.rbindex 34f375aee39..b22d207018a 100644--- a/spec/services/project_custom_field_project_mappings/bulk_update_service_spec.rb+++ b/spec/services/project_custom_field_project_mappings/bulk_update_service_spec.rb@@ -35,14 +35,14 @@ RSpec.describe ProjectCustomFieldProjectMappings::BulkUpdateService dolet!(:visible_project_custom_field) docreate(:project_custom_field,name: "Visible field",- visible: true,+ admin_only: false,project_custom_field_section: section_with_invisible_fields)endlet!(:visible_required_project_custom_field) docreate(:project_custom_field,name: "Visible required field",- visible: true,+ admin_only: false,is_required: true,project_custom_field_section: section_with_invisible_fields)end@@ -50,7 +50,7 @@ RSpec.describe ProjectCustomFieldProjectMappings::BulkUpdateService dolet!(:invisible_project_custom_field) docreate(:project_custom_field,name: "Admin only field",- visible: false,+ admin_only: true,project_custom_field_section: section_with_invisible_fields)enddiff --git a/spec/services/project_custom_field_project_mappings/toggle_service_spec.rb b/spec/services/project_custom_field_project_mappings/toggle_service_spec.rbindex 51a62e0d4ae..ac2c05a54e4 100644--- a/spec/services/project_custom_field_project_mappings/toggle_service_spec.rb+++ b/spec/services/project_custom_field_project_mappings/toggle_service_spec.rb@@ -35,14 +35,14 @@ RSpec.describe ProjectCustomFieldProjectMappings::ToggleService dolet!(:visible_project_custom_field) docreate(:project_custom_field,name: "Visible field",- visible: true,+ admin_only: false,project_custom_field_section: section_with_invisible_fields)endlet!(:visible_required_project_custom_field) docreate(:project_custom_field,name: "Visible required field",- visible: true,+ admin_only: false,is_required: true,project_custom_field_section: section_with_invisible_fields)end@@ -50,7 +50,7 @@ RSpec.describe ProjectCustomFieldProjectMappings::ToggleService dolet!(:invisible_project_custom_field) docreate(:project_custom_field,name: "Admin only field",- visible: false,+ admin_only: true,project_custom_field_section: section_with_invisible_fields)enddiff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rbindex 682f4e7e4d9..8c697e15675 100644--- a/spec/services/projects/create_service_spec.rb+++ b/spec/services/projects/create_service_spec.rb@@ -84,7 +84,7 @@ RSpec.describe Projects::CreateService, type: :model docreate(:list_project_custom_field, project_custom_field_section: section)endlet!(:hidden_custom_field) do- create(:text_project_custom_field, project_custom_field_section: section, visible: false)+ create(:text_project_custom_field, project_custom_field_section: section, admin_only: true)endlet(:project) { subject.result }let(:project_attributes) { {} }