BigW Consortium Gitlab

env.rb 1 KB
Newer Older
Dmitriy Zaporozhets committed
1
require 'simplecov' unless ENV['CI']
2

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

8 9
ENV['RAILS_ENV'] = 'test'
require './config/environment'
Dmitriy Zaporozhets committed
10

11 12
require 'rspec'
require 'database_cleaner'
13
require 'spinach/capybara'
14 15
require 'sidekiq/testing/inline'

16

17
%w(valid_commit select2_helper test_env).each do |f|
18 19 20
  require Rails.root.join('spec', 'support', f)
end

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

23
WebMock.allow_net_connect!
24 25 26 27 28 29 30 31
#
# JS driver
#
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
Spinach.hooks.on_tag("javascript") do
  ::Capybara.current_driver = ::Capybara.javascript_driver
end
32
Capybara.default_wait_time = 10
33
Capybara.ignore_hidden_elements = false
34 35

DatabaseCleaner.strategy = :truncation
36 37

Spinach.hooks.before_scenario do
38
  TestEnv.init(mailer: false)
39

40
  DatabaseCleaner.start
41 42 43 44 45
end

Spinach.hooks.after_scenario do
  DatabaseCleaner.clean
end
46 47 48 49

Spinach.hooks.before_run do
  RSpec::Mocks::setup self

50
  include FactoryGirl::Syntax::Methods
51
end