summaryrefslogtreecommitdiff
path: root/features/support/env.rb
blob: c1cfabd0d6a9fe31d959c7edddd6aa9621288f3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
if ENV['SIMPLECOV']
  require 'simplecov'

  SimpleCov.start :rails do
    if ENV['CI_BUILD_NAME']
      coverage_dir "coverage/#{ENV['CI_BUILD_NAME']}"
      command_name ENV['CI_BUILD_NAME']
      merge_timeout 7200
    end
  end
end

ENV['RAILS_ENV'] = 'test'
require './config/environment'
require 'rspec/expectations'
require 'sidekiq/testing/inline'

require_relative 'capybara'
require_relative 'db_cleaner'
require_relative 'rerun'

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

%w(select2_helper test_env repo_helpers).each do |f|
  require Rails.root.join('spec', 'support', f)
end

Dir["#{Rails.root}/features/steps/shared/*.rb"].each { |file| require file }

WebMock.allow_net_connect!

Spinach.hooks.before_run do
  include RSpec::Mocks::ExampleMethods
  RSpec::Mocks.setup
  TestEnv.init(mailer: false)

  # skip pre-receive hook check so we can use
  # web editor and merge
  TestEnv.disable_pre_receive

  include FactoryGirl::Syntax::Methods
end