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

Fix flaky token_strategy_manager_spec.rb test

Christophe Bliard234e9a56f606
diff --git a/spec/lib/rubocop/cop/open_project/no_do_end_block_with_rspec_capybara_matcher_in_expect_spec.rb b/spec/lib/rubocop/cop/open_project/no_do_end_block_with_rspec_capybara_matcher_in_expect_spec.rb
index be912e50f25..901cbe40c91 100644
--- a/spec/lib/rubocop/cop/open_project/no_do_end_block_with_rspec_capybara_matcher_in_expect_spec.rb
+++ b/spec/lib/rubocop/cop/open_project/no_do_end_block_with_rspec_capybara_matcher_in_expect_spec.rb
@@ -26,10 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'rubocop'
-require 'rubocop/rspec/shared_contexts'
require 'spec_helper'
-require 'rubocop/rspec/support'
require 'rubocop/cop/open_project/no_do_end_block_with_rspec_capybara_matcher_in_expect'
RSpec.describe RuboCop::Cop::OpenProject::NoDoEndBlockWithRSpecCapybaraMatcherInExpect do
diff --git a/spec/lib/rubocop/cop/open_project/use_service_result_factory_methods_spec.rb b/spec/lib/rubocop/cop/open_project/use_service_result_factory_methods_spec.rb
index c228a0d33ed..da4b343d0ee 100644
--- a/spec/lib/rubocop/cop/open_project/use_service_result_factory_methods_spec.rb
+++ b/spec/lib/rubocop/cop/open_project/use_service_result_factory_methods_spec.rb
@@ -26,10 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'rubocop'
-require 'rubocop/rspec/shared_contexts'
require 'spec_helper'
-require 'rubocop/rspec/support'
require 'rubocop/cop/open_project/use_service_result_factory_methods'
RSpec.describe RuboCop::Cop::OpenProject::UseServiceResultFactoryMethods do
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 411a7217f55..8020c4e4ec9 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -41,6 +41,15 @@ require "test_prof/recipes/rspec/factory_default"
# https://github.com/paper-trail-gem/paper_trail#7b-rspec
require 'paper_trail/frameworks/rspec'
+# Add rubocop rspec helpers for our cop tests. It needs to be done before RSpec
+# requires all files so that the CopHelper module does not hide some let
+# definitions.
+#
+# Ideally we should move our cops to their own gem.
+require 'rubocop'
+require 'rubocop/rspec/shared_contexts'
+require 'rubocop/rspec/support'
+
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end