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
add specs
Dombi Attila84f776909564
diff --git a/spec/features/activities/project_attributes_activity_spec.rb b/spec/features/activities/project_attributes_activity_spec.rbindex f19f4742669..88464dee9e9 100644--- a/spec/features/activities/project_attributes_activity_spec.rb+++ b/spec/features/activities/project_attributes_activity_spec.rb@@ -29,9 +29,15 @@require "spec_helper"RSpec.describe "Project attributes activity", :js, :with_cuprite do- let(:user) { create(:user, member_with_permissions: { project => %i[view_work_packages edit_work_packages] }) }+ let(:user) do+ create(:user, member_with_permissions: {+ project => %i[view_work_packages edit_work_packages],+ project2 => %i[view_work_packages edit_work_packages]+ })+ endlet(:parent_project) { create(:project, name: "parent") }let(:project) { create(:project, parent: parent_project, active: false) }+ let(:project2) { create(:project, parent: parent_project, active: false) }let!(:list_project_custom_field) { create(:list_project_custom_field) }let!(:version_project_custom_field) { create(:version_project_custom_field) }@@ -43,24 +49,33 @@ RSpec.describe "Project attributes activity", :js, :with_cuprite dolet!(:string_project_custom_field) { create(:string_project_custom_field) }let!(:date_project_custom_field) { create(:date_project_custom_field) }- let(:old_version) { create(:version, project:, name: "Ringbo 1.0") }- let(:next_version) { create(:version, project:, name: "Turfu 2.0") }+ let(:old_version) do+ { project => create(:version, project:, name: "Ringbo 1.0"),+ project2 => create(:version, project: project2, name: "Ringbo 2.0") }+ end++ let(:next_version) do+ {+ project => create(:version, project:, name: "Turfu 2.0"),+ project2 => create(:version, project: project2, name: "Turfu 3.0")+ }+ endcurrent_user { user }- def generate_trackable_activity_on_project+ def generate_trackable_activity_on_project(project)new_project_attributes = {- name: "a new project name",+ name: "a new project name-#{project.id}",description: "a new project description",status_code: "on_track",status_explanation: "some explanation",public: true,parent: nil,- identifier: "a-new-project-name",+ identifier: "a-new-project-name-#{project.id}",active: true,templated: true,list_project_custom_field.attribute_name => list_project_custom_field.possible_values.first.id,- version_project_custom_field.attribute_name => [old_version.id, next_version.id],+ version_project_custom_field.attribute_name => [old_version[project].id, next_version[project].id],bool_project_custom_field.attribute_name => true,user_project_custom_field.attribute_name => current_user.id,int_project_custom_field.attribute_name => 42,@@ -73,15 +88,15 @@ RSpec.describe "Project attributes activity", :js, :with_cuprite doproject.update!(new_project_attributes)end- it "tracks the project's activities" do+ it "tracks the projects activities" doprevious_project_attributes = project.attributes.dup- generate_trackable_activity_on_project+ generate_trackable_activity_on_project(project)visit project_activity_index_path(project)check "Project attributes"- click_button "Apply"+ click_on "Apply"within("li.op-activity-list--item", match: :first) doexpect(page)@@ -103,7 +118,7 @@ RSpec.describe "Project attributes activity", :js, :with_cuprite doexpect(page).to have_css("li", text: "#{list_project_custom_field.name} " \"set to #{project.send(list_project_custom_field.attribute_getter)}")expect(page).to have_css("li", text: "#{version_project_custom_field.name} " \- "set to #{old_version.name}, #{next_version.name}")+ "set to #{old_version[project].name}, #{next_version[project].name}")expect(page).to have_css("li", text: "#{bool_project_custom_field.name} set to Yes")expect(page).to have_css("li", text: "#{user_project_custom_field.name} set to #{current_user.name}")expect(page).to have_css("li", text: "#{int_project_custom_field.name} set to 42")@@ -113,4 +128,57 @@ RSpec.describe "Project attributes activity", :js, :with_cuprite doexpect(page).to have_css("li", text: "#{date_project_custom_field.name} set to 01/31/2023")endend++ describe "the general activities page" do+ it "is expected to not show disabled attribute only on the project it was disabled on" do+ previous_project_attributes = project.attributes.dup+ generate_trackable_activity_on_project(project)+ generate_trackable_activity_on_project(project2)+ # Disable all custom fields on the project+ project.project_custom_field_project_mappings.destroy_all++ visit activity_index_path++ check "Project attributes"++ click_on "Apply"++ within("li.op-activity-list--item:nth-child(2)") do+ expect(page)+ .to have_link("Project: #{project.name}")++ # own fields+ expect(page).to have_css("li", text: "Name changed from #{previous_project_attributes['name']} to #{project.name}")+ expect(page).to have_css("li", text: "Description set (Details)")+ expect(page).to have_css("li", text: "Project status set to On track")+ expect(page).to have_css("li", text: "Project status description set (Details)")+ expect(page).to have_css("li", text: "Visibility set to public")+ expect(page).to have_css("li", text: "No longer subproject of #{parent_project.name}")+ expect(page).to have_css("li", text: "Project unarchived")+ expect(page).to have_css("li", text: "Identifier changed from #{previous_project_attributes['identifier']} " \+ "to #{project.identifier}")+ expect(page).to have_css("li", text: "Project marked as template")++ # custom fields+ expect(page).to have_no_css("li", text: "#{list_project_custom_field.name} " \+ "set to #{project.send(list_project_custom_field.attribute_getter)}")+ expect(page).to have_no_css("li", text: "#{version_project_custom_field.name} " \+ "set to #{old_version[project].name}, #{next_version[project].name}")+ expect(page).to have_no_css("li", text: "#{bool_project_custom_field.name} set to Yes")+ expect(page).to have_no_css("li", text: "#{user_project_custom_field.name} set to #{current_user.name}")+ expect(page).to have_no_css("li", text: "#{int_project_custom_field.name} set to 42")+ expect(page).to have_no_css("li", text: "#{float_project_custom_field.name} set to 3.14159")+ expect(page).to have_no_css("li", text: "#{text_project_custom_field.name} set to\na new text CF value")+ expect(page).to have_no_css("li", text: "#{string_project_custom_field.name} set to a new string CF value")+ expect(page).to have_no_css("li", text: "#{date_project_custom_field.name} set to 01/31/2023")+ end++ within("li.op-activity-list--item:nth-child(1)") do+ expect(page)+ .to have_link("Project: #{project2.name}")++ expect(page).to have_css("li", text: "#{int_project_custom_field.name} set to 42")+ end+ end+ endend