diff options
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r-- | spec/spec_helper.rb | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 97e7a019222..3f723ebab67 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,34 +1,34 @@ -require './spec/simplecov_env' +require "./spec/simplecov_env" SimpleCovEnv.start! -ENV["RAILS_ENV"] = 'test' -ENV["IN_MEMORY_APPLICATION_SETTINGS"] = 'true' +ENV["RAILS_ENV"] = "test" +ENV["IN_MEMORY_APPLICATION_SETTINGS"] = "true" -require File.expand_path('../config/environment', __dir__) -require 'rspec/rails' -require 'shoulda/matchers' -require 'rspec/retry' -require 'rspec-parameterized' +require File.expand_path("../config/environment", __dir__) +require "rspec/rails" +require "shoulda/matchers" +require "rspec/retry" +require "rspec-parameterized" rspec_profiling_is_configured = - ENV['RSPEC_PROFILING_POSTGRES_URL'].present? || - ENV['RSPEC_PROFILING'] + ENV["RSPEC_PROFILING_POSTGRES_URL"].present? || + ENV["RSPEC_PROFILING"] branch_can_be_profiled = - ENV['GITLAB_DATABASE'] == 'postgresql' && - (ENV['CI_COMMIT_REF_NAME'] == 'master' || - ENV['CI_COMMIT_REF_NAME'] =~ /rspec-profile/) + ENV["GITLAB_DATABASE"] == "postgresql" && + (ENV["CI_COMMIT_REF_NAME"] == "master" || + ENV["CI_COMMIT_REF_NAME"] =~ /rspec-profile/) -if rspec_profiling_is_configured && (!ENV.key?('CI') || branch_can_be_profiled) - require 'rspec_profiling/rspec' +if rspec_profiling_is_configured && (!ENV.key?("CI") || branch_can_be_profiled) + require "rspec_profiling/rspec" end -if ENV['CI'] && ENV['KNAPSACK_GENERATE_REPORT'] && !ENV['NO_KNAPSACK'] - require 'knapsack' +if ENV["CI"] && ENV["KNAPSACK_GENERATE_REPORT"] && !ENV["NO_KNAPSACK"] + require "knapsack" Knapsack::Adapters::RSpecAdapter.bind end # require rainbow gem String monkeypatch, so we can test SystemChecks -require 'rainbow/ext/string' +require "rainbow/ext/string" Rainbow.enabled = false # Requires supporting ruby files with custom matchers and macros, etc, @@ -97,13 +97,14 @@ RSpec.configure do |config| config.include RedisHelpers config.include Rails.application.routes.url_helpers, type: :routing - if ENV['CI'] + if ENV["CI"] # This includes the first try, i.e. tests will be run 4 times before failing. config.default_retry_count = 4 config.reporter.register_listener( RspecFlaky::Listener.new, :example_passed, - :dump_summary) + :dump_summary + ) end config.before(:suite) do @@ -129,7 +130,7 @@ RSpec.configure do |config| config.before(:example, :quarantine) do # Skip tests in quarantine unless we explicitly focus on them. - skip('In quarantine') unless config.inclusion_filter[:quarantine] + skip("In quarantine") unless config.inclusion_filter[:quarantine] end config.before(:example, :request_store) do @@ -253,11 +254,11 @@ RSpec.configure do |config| end config.before(:each, :http_pages_enabled) do |_| - allow(Gitlab.config.pages).to receive(:external_http).and_return(['1.1.1.1:80']) + allow(Gitlab.config.pages).to receive(:external_http).and_return(["1.1.1.1:80"]) end config.before(:each, :https_pages_enabled) do |_| - allow(Gitlab.config.pages).to receive(:external_https).and_return(['1.1.1.1:443']) + allow(Gitlab.config.pages).to receive(:external_https).and_return(["1.1.1.1:443"]) end config.before(:each, :http_pages_disabled) do |_| @@ -274,7 +275,7 @@ RSpec::Matchers.define :match_asset_path do |expected| match do |actual| path = Regexp.escape(expected) extname = Regexp.escape(File.extname(expected)) - digest_regex = Regexp.new(path.sub(extname, "(?:-\\h+)?#{extname}") << '$') + digest_regex = Regexp.new(path.sub(extname, "(?:-\\h+)?#{extname}") << "$") digest_regex =~ actual end @@ -301,4 +302,4 @@ Shoulda::Matchers.configure do |config| end # Prevent Rugged from picking up local developer gitconfig. -Rugged::Settings['search_path_global'] = Rails.root.join('tmp/tests').to_s +Rugged::Settings["search_path_global"] = Rails.root.join("tmp/tests").to_s |