Skip to content

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

ask before destruction specs

Klaus Zanders4a411e8a0271
diff --git a/spec/models/work_package/ask_before_destruction_spec.rb b/spec/models/work_package/ask_before_destruction_spec.rb
index e5fcda3cdf4..0389163661b 100644
--- a/spec/models/work_package/ask_before_destruction_spec.rb
+++ b/spec/models/work_package/ask_before_destruction_spec.rb
@@ -63,12 +63,12 @@ RSpec.describe WorkPackage do
let(:time_entry) do
create(:time_entry,
hours: time_entry_hours,
- work_package:,
+ entity: work_package,
project: work_package.project)
end
let(:time_entry2) do
create(:time_entry,
- work_package: work_package2,
+ entity: work_package2,
project: work_package2.project)
end
@@ -160,7 +160,7 @@ RSpec.describe WorkPackage do
action
time_entry.reload
- expect(time_entry.work_package_id).to eq(work_package.id)
+ expect(time_entry.entity).to eq(work_package)
end
end
@@ -175,22 +175,22 @@ RSpec.describe WorkPackage do
action
time_entry.reload
- expect(time_entry.work_package_id).to eq(work_package.id)
+ expect(time_entry.entity).to eq(work_package)
end
end
- describe 'with "nullify" as action' do
+ describe 'with "nullify" as action', skip: "nullify of time entry entity is currently not possible" do
let(:action) { WorkPackage.cleanup_associated_before_destructing_if_required([work_package], user, action: "nullify") }
it "returns true" do
expect(action).to be_truthy
end
- it "sets the work_package_id of all time entries to nil" do
+ it "sets the entity of all time entries to nil" do
action
time_entry.reload
- expect(time_entry.work_package_id).to be_nil
+ expect(time_entry.entity).to be_nil
end
end
@@ -214,11 +214,11 @@ RSpec.describe WorkPackage do
expect(action).to be_truthy
end
- it "sets the work_package_id of all time entries to the new work package" do
+ it "sets the entity of all time entries to the new work package" do
action
time_entry.reload
- expect(time_entry.work_package_id).to eq(work_package2.id)
+ expect(time_entry.entity).to eq(work_package2)
end
it "sets the project_id of all time entries to the new work package's project" do
@@ -248,11 +248,11 @@ RSpec.describe WorkPackage do
expect(action).to be_truthy
end
- it "sets the work_package_id of all time entries to the new work package" do
+ it "sets the entity of all time entries to the new work package" do
action
time_entry.reload
- expect(time_entry.work_package_id).to eq(work_package2.id)
+ expect(time_entry.entity).to eq(work_package2)
end
it "sets the project_id of all time entries to the new work package's project" do
@@ -281,11 +281,11 @@ RSpec.describe WorkPackage do
expect(action).to be_falsey
end
- it "does not alter the work_package_id of all time entries" do
+ it "does not alter the entity of all time entries" do
action
time_entry.reload
- expect(time_entry.work_package_id).to eq(work_package.id)
+ expect(time_entry.entity).to eq(work_package)
end
end
@@ -302,11 +302,11 @@ RSpec.describe WorkPackage do
expect(action).to be_falsey
end
- it "does not alter the work_package_id of all time entries" do
+ it "does not alter the entity of all time entries" do
action
time_entry.reload
- expect(time_entry.work_package_id).to eq(work_package.id)
+ expect(time_entry.entity).to eq(work_package)
end
it "sets an error on work packages" do
@@ -329,11 +329,11 @@ RSpec.describe WorkPackage do
expect(action).to be_falsey
end
- it "does not alter the work_package_id of all time entries" do
+ it "does not alter the entity of all time entries" do
action
time_entry.reload
- expect(time_entry.work_package_id).to eq(work_package.id)
+ expect(time_entry.entity).to eq(work_package)
end
it "sets an error on work packages" do