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

[#36559] fix query_spec

Tobias Dillmann25e5ebede227
diff --git a/spec/models/query_spec.rb b/spec/models/query_spec.rb
index 8c33495b669..6940ff96dc0 100644
--- a/spec/models/query_spec.rb
+++ b/spec/models/query_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
@@ -341,6 +343,9 @@ RSpec.describe Query,
end
it "does call the db if the project changes" do
+ relation_stub = double
+ allow(relation_stub).to receive(:visible_by_user).and_return([])
+
query.project = project
query.displayable_columns
@@ -349,7 +354,7 @@ RSpec.describe Query,
expect(project2)
.to receive(:all_work_package_custom_fields)
- .and_return []
+ .and_return relation_stub
expect(project2)
.to receive(:types)
@@ -359,6 +364,9 @@ RSpec.describe Query,
end
it "does call the db if the project changes to nil" do
+ relation_stub = double
+ allow(relation_stub).to receive(:visible_by_user).and_return([])
+
query.project = project
query.displayable_columns
@@ -367,7 +375,7 @@ RSpec.describe Query,
expect(WorkPackageCustomField)
.to receive(:all)
- .and_return []
+ .and_return relation_stub
expect(Type)
.to receive(:all)