Commit 767c5bb7 authored by Nick Thomas's avatar Nick Thomas

Merge branch '6420-unify-spec_helper.rb' into 'master'

Resolve "Extract EE specific files/lines for spec/spec_helper.rb"

Closes #6420

See merge request gitlab-org/gitlab-ee!6140
parents 3b4e7a4d 3fee9c44
Dir[Rails.root.join("ee/spec/support/helpers/*.rb")].each { |f| require f }
Dir[Rails.root.join("ee/spec/support/shared_contexts/*.rb")].each { |f| require f }
Dir[Rails.root.join("ee/spec/support/shared_examples/*.rb")].each { |f| require f }
Dir[Rails.root.join("ee/spec/support/**/*.rb")].each { |f| require f }
RSpec.configure do |config|
config.include EE::LicenseHelpers
config.before(:all) do
License.destroy_all
TestLicense.init
end
config.around(:each, :geo) do |example|
example.run if Gitlab::Database.postgresql?
end
config.around(:each, :geo_tracking_db) do |example|
example.run if Gitlab::Geo.geo_database_configured?
end
end
...@@ -30,12 +30,7 @@ end ...@@ -30,12 +30,7 @@ end
# require rainbow gem String monkeypatch, so we can test SystemChecks # require rainbow gem String monkeypatch, so we can test SystemChecks
require 'rainbow/ext/string' require 'rainbow/ext/string'
# EE specific support START require_relative '../ee/spec/spec_helper'
Dir[Rails.root.join("ee/spec/support/helpers/*.rb")].each { |f| require f }
Dir[Rails.root.join("ee/spec/support/shared_contexts/*.rb")].each { |f| require f }
Dir[Rails.root.join("ee/spec/support/shared_examples/*.rb")].each { |f| require f }
Dir[Rails.root.join("ee/spec/support/**/*.rb")].each { |f| require f }
# EE specific support END
# Requires supporting ruby files with custom matchers and macros, etc, # Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories. # in spec/support/ and its subdirectories.
...@@ -94,11 +89,7 @@ RSpec.configure do |config| ...@@ -94,11 +89,7 @@ RSpec.configure do |config|
config.include LiveDebugger, :js config.include LiveDebugger, :js
config.include MigrationsHelpers, :migration config.include MigrationsHelpers, :migration
config.include RedisHelpers config.include RedisHelpers
# EE only START
config.include EE::LicenseHelpers
config.include Rails.application.routes.url_helpers, type: :routing config.include Rails.application.routes.url_helpers, type: :routing
# EE only END
if ENV['CI'] if ENV['CI']
# This includes the first try, i.e. tests will be run 4 times before failing. # This includes the first try, i.e. tests will be run 4 times before failing.
...@@ -114,13 +105,6 @@ RSpec.configure do |config| ...@@ -114,13 +105,6 @@ RSpec.configure do |config|
TestEnv.init TestEnv.init
end end
# EE-specific start
config.before(:all) do
License.destroy_all
TestLicense.init
end
# EE-specific stop
config.after(:all) do config.after(:all) do
TestEnv.clean_test_path TestEnv.clean_test_path
end end
...@@ -215,14 +199,6 @@ RSpec.configure do |config| ...@@ -215,14 +199,6 @@ RSpec.configure do |config|
example.run if Group.supports_nested_groups? example.run if Group.supports_nested_groups?
end end
config.around(:each, :geo) do |example|
example.run if Gitlab::Database.postgresql?
end
config.around(:each, :geo_tracking_db) do |example|
example.run if Gitlab::Geo.geo_database_configured?
end
config.around(:each, :postgresql) do |example| config.around(:each, :postgresql) do |example|
example.run if Gitlab::Database.postgresql? example.run if Gitlab::Database.postgresql?
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment