BigW Consortium Gitlab

spec_helper.rb 1.07 KB
Newer Older
1 2 3
if ENV['SIMPLECOV']
  require 'simplecov'
end
Andrew8xx8 committed
4

5
if ENV['COVERALLS']
Robert Speicher committed
6
  require 'coveralls'
7
  Coveralls.wear_merged!
gitlabhq committed
8
end
Andrew8xx8 committed
9

10 11
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
Robert Speicher committed
12 13 14 15 16 17 18
require 'rspec/rails'
require 'webmock/rspec'
require 'email_spec'
require 'sidekiq/testing/inline'

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

WebMock.disable_net_connect!(allow_localhost: true)
Andrew8xx8 committed
22

Robert Speicher committed
23
RSpec.configure do |config|
Jeroen van Baarsen committed
24 25
  config.use_transactional_fixtures = false
  config.use_instantiated_fixtures  = false
Robert Speicher committed
26 27 28 29 30 31 32 33
  config.mock_with :rspec

  config.include LoginHelpers, type: :feature
  config.include LoginHelpers, type: :request
  config.include FactoryGirl::Syntax::Methods
  config.include Devise::TestHelpers, type: :controller

  config.include TestEnv
34
  config.infer_spec_type_from_file_location!
35
  config.raise_errors_for_deprecations!
Robert Speicher committed
36 37

  config.before(:suite) do
38
    TestEnv.init
Robert Speicher committed
39
  end
Andrew8xx8 committed
40
end
41 42

ActiveRecord::Migration.maintain_test_schema!