2013-01-07 15:22:35 -05:00
|
|
|
require 'simplecov' unless ENV['CI']
|
2013-01-05 06:30:42 -05:00
|
|
|
|
2013-03-10 14:26:27 -04:00
|
|
|
if ENV['TRAVIS']
|
|
|
|
require 'coveralls'
|
|
|
|
Coveralls.wear!
|
|
|
|
end
|
|
|
|
|
2012-09-10 03:52:43 -04:00
|
|
|
ENV['RAILS_ENV'] = 'test'
|
|
|
|
require './config/environment'
|
2012-06-15 00:15:28 -04:00
|
|
|
|
2012-09-10 03:52:43 -04:00
|
|
|
require 'rspec'
|
|
|
|
require 'database_cleaner'
|
2012-09-10 08:34:01 -04:00
|
|
|
require 'spinach/capybara'
|
2013-01-09 01:14:05 -05:00
|
|
|
require 'sidekiq/testing/inline'
|
|
|
|
|
2012-08-28 17:04:06 -04:00
|
|
|
|
2013-09-04 03:33:09 -04:00
|
|
|
%w(valid_commit big_commits select2_helper chosen_helper test_env).each do |f|
|
2012-09-10 04:51:02 -04:00
|
|
|
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}
|
|
|
|
|
2012-09-10 07:27:11 -04:00
|
|
|
WebMock.allow_net_connect!
|
2012-11-16 05:27:39 -05:00
|
|
|
#
|
|
|
|
# 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 => 60)
|
|
|
|
end
|
2012-11-16 05:27:39 -05:00
|
|
|
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
|
2013-04-11 04:25:11 -04:00
|
|
|
Capybara.ignore_hidden_elements = false
|
2012-09-10 07:27:11 -04:00
|
|
|
|
|
|
|
DatabaseCleaner.strategy = :truncation
|
2012-11-16 05:27:39 -05:00
|
|
|
|
|
|
|
Spinach.hooks.before_scenario do
|
2013-04-25 10:15:33 -04:00
|
|
|
TestEnv.setup_stubs
|
2013-02-28 14:02:41 -05:00
|
|
|
DatabaseCleaner.start
|
2012-11-16 05:27:39 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
Spinach.hooks.after_scenario do
|
|
|
|
DatabaseCleaner.clean
|
|
|
|
end
|
2012-09-10 07:27:11 -04:00
|
|
|
|
|
|
|
Spinach.hooks.before_run do
|
2013-04-25 10:15:33 -04:00
|
|
|
TestEnv.init(mailer: false, init_repos: true, repos: false)
|
2012-09-10 07:27:11 -04:00
|
|
|
RSpec::Mocks::setup self
|
|
|
|
|
2012-09-25 22:34:29 -04:00
|
|
|
include FactoryGirl::Syntax::Methods
|
2013-10-04 15:11:50 -04:00
|
|
|
MergeRequestObserver.any_instance.stub(current_user: create(:user))
|
2012-09-10 07:27:11 -04:00
|
|
|
end
|
2013-10-04 15:11:50 -04:00
|
|
|
|