• Lin Jen-Shin's avatar
    Merge remote-tracking branch 'upstream/master' into artifacts-from-ref-and-build-name · 616af037
    Lin Jen-Shin authored
    * upstream/master: (192 commits)
      Added CHANGELOG
      Added unfold test to parallel and added 'diff discussion' context
      Fix Spinach branches spec
      Better first match on this MR also
      Change merge_error column from string to text type
      Fix typo in gitlab_flow.md
      entities: make Environment inherit EnvironmentBasic
      Updated to optimized specs from !5864
      Added 'with an unfolded line should not allow commenting' scenario (line 125)
      Added addtional 'renderable' validator to check 'data-note-type' attr exists
      Allow passing an index to selectRowAtIndex
      Fixed enter key in search input not working
      Fix file links on project page Files view
      Fix incorrect "stopped impersonation" log message
      8.11 is released, long live 8.12
      Also check if Akismet is enabled, before showing the `Submit as spam` button.
      fix location of markdown help location
      Fix for update 8.10-to-8.11.md doc.
      Appease the linter.
      Add Ruby 2.3 upgrade notes.
      ...
    616af037
spec_helper.rb 1.6 KB
require './spec/simplecov_env'
SimpleCovEnv.start!

ENV["RAILS_ENV"] ||= 'test'

require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'shoulda/matchers'
require 'sidekiq/testing/inline'
require 'rspec/retry'

if ENV['CI']
  require 'knapsack'
  Knapsack::Adapters::RSpecAdapter.bind
end

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

RSpec.configure do |config|
  config.use_transactional_fixtures = false
  config.use_instantiated_fixtures  = false
  config.mock_with :rspec

  config.verbose_retry = true
  config.display_try_failure_messages = true

  config.include Devise::TestHelpers,   type: :controller
  config.include Warden::Test::Helpers, type: :request
  config.include LoginHelpers,          type: :feature
  config.include StubConfiguration
  config.include EmailHelpers
  config.include TestEnv
  config.include ActiveJob::TestHelper
  config.include ActiveSupport::Testing::TimeHelpers
  config.include StubGitlabCalls
  config.include StubGitlabData

  config.infer_spec_type_from_file_location!
  config.raise_errors_for_deprecations!

  config.before(:suite) do
    TestEnv.init
  end

  config.around(:each, :caching) do |example|
    caching_store = Rails.cache
    Rails.cache = ActiveSupport::Cache::MemoryStore.new if example.metadata[:caching]
    example.run
    Rails.cache = caching_store
  end
end

FactoryGirl::SyntaxRunner.class_eval do
  include RSpec::Mocks::ExampleMethods
end

ActiveRecord::Migration.maintain_test_schema!