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

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

10 11
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
Robert Speicher's avatar
Robert Speicher committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
require 'rspec/rails'
require 'capybara/rails'
require 'capybara/rspec'
require 'webmock/rspec'
require 'email_spec'
require 'sidekiq/testing/inline'
require 'capybara/poltergeist'

Capybara.javascript_driver = :poltergeist
Capybara.default_wait_time = 10

# 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}

WebMock.disable_net_connect!(allow_localhost: true)
Andrew8xx8's avatar
Andrew8xx8 committed
28

Robert Speicher's avatar
Robert Speicher committed
29
RSpec.configure do |config|
Jeroen van Baarsen's avatar
Jeroen van Baarsen committed
30 31
  config.use_transactional_fixtures = false
  config.use_instantiated_fixtures  = false
Robert Speicher's avatar
Robert Speicher committed
32 33 34 35 36 37 38 39
  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
40
  config.infer_spec_type_from_file_location!
Robert Speicher's avatar
Robert Speicher committed
41 42

  config.before(:suite) do
43
    TestEnv.init
Robert Speicher's avatar
Robert Speicher committed
44
  end
Andrew8xx8's avatar
Andrew8xx8 committed
45
end