spec_helper.rb 1.47 KB
Newer Older
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
1
require 'simplecov' unless ENV['CI']
gitlabhq's avatar
gitlabhq committed
2

3 4 5 6
if ENV['TRAVIS']
  require 'coveralls'
  Coveralls.wear!
end
7

gitlabhq's avatar
gitlabhq committed
8 9 10 11 12 13
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rails'
require 'capybara/rspec'
14
require 'webmock/rspec'
15
require 'email_spec'
16
require 'sidekiq/testing/inline'
17 18
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
19
Capybara.default_wait_time = 10
gitlabhq's avatar
gitlabhq committed
20 21 22 23 24

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

25 26
WebMock.disable_net_connect!(allow_localhost: true)

gitlabhq's avatar
gitlabhq committed
27 28 29
RSpec.configure do |config|
  config.mock_with :rspec

30
  config.include LoginHelpers, type: :feature
31
  config.include LoginHelpers, type: :request
32
  config.include FactoryGirl::Syntax::Methods
33
  config.include Devise::TestHelpers, type: :controller
gitlabhq's avatar
gitlabhq committed
34 35 36 37 38 39 40

  # If you're not using ActiveRecord, or you'd prefer not to run each of your
  # examples within a transaction, remove the following line or assign false
  # instead of true.
  config.use_transactional_fixtures = false

  config.before do
41
    # Use tmp dir for FS manipulations
42
    temp_repos_path = Rails.root.join('tmp', 'test-git-base-path')
43
    Gitlab.config.gitlab_shell.stub(repos_path: temp_repos_path)
44 45
    FileUtils.rm_rf temp_repos_path
    FileUtils.mkdir_p temp_repos_path
gitlabhq's avatar
gitlabhq committed
46 47
  end
end