gitlab-org--gitlab-foss/features/support/env.rb

55 lines
1.2 KiB
Ruby
Raw Normal View History

if ENV['SIMPLECOV']
require 'simplecov'
end
if ENV['COVERALLS']
2013-03-10 14:26:27 -04:00
require 'coveralls'
Coveralls.wear_merged!
2013-03-10 14:26:27 -04:00
end
2012-09-10 03:52:43 -04:00
ENV['RAILS_ENV'] = 'test'
require './config/environment'
require 'rspec'
require 'rspec/expectations'
2012-09-10 03:52:43 -04:00
require 'database_cleaner'
require 'spinach/capybara'
2013-01-09 01:14:05 -05:00
require 'sidekiq/testing/inline'
%w(select2_helper test_env repo_helpers).each do |f|
require Rails.root.join('spec', 'support', f)
end
2012-09-10 11:35:03 -04:00
Dir["#{Rails.root}/features/steps/shared/*.rb"].each {|file| require file}
WebMock.allow_net_connect!
#
# JS driver
#
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
2013-09-12 18:30:49 -04:00
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, js_errors: false, timeout: 90)
2013-09-12 18:30:49 -04:00
end
Spinach.hooks.on_tag("javascript") do
::Capybara.current_driver = ::Capybara.javascript_driver
end
2013-09-12 18:30:49 -04:00
Capybara.default_wait_time = 60
Capybara.ignore_hidden_elements = false
DatabaseCleaner.strategy = :truncation
Spinach.hooks.before_scenario do
DatabaseCleaner.start
end
Spinach.hooks.after_scenario do
DatabaseCleaner.clean
end
Spinach.hooks.before_run do
2014-07-31 12:24:53 -04:00
TestEnv.init(mailer: false)
RSpec::Mocks::setup self
include FactoryGirl::Syntax::Methods
end