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

use current_user helper instead of stubbing User.current

Ivan Kuchin4883fc3834b2
diff --git a/spec/models/queries/projects/orders/custom_field_order_spec.rb b/spec/models/queries/projects/orders/custom_field_order_spec.rb
index 4e87d93e5fa..1e4d164cd82 100644
--- a/spec/models/queries/projects/orders/custom_field_order_spec.rb
+++ b/spec/models/queries/projects/orders/custom_field_order_spec.rb
@@ -65,9 +65,7 @@ RSpec.describe Queries::Projects::Orders::CustomFieldOrder do
describe "#available?" do
let(:instance) { described_class.new("cf_#{custom_field.id}") }
- before do
- allow(User).to receive(:current).and_return build_stubbed(:admin)
- end
+ current_user { build_stubbed(:admin) }
context "for int custom field" do
let!(:custom_field) { create(:project_custom_field, :integer) }