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'
|
2013-12-06 10:40:39 -05:00
|
|
|
require 'rspec/expectations'
|
2012-09-10 03:52:43 -04:00
|
|
|
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
|
|
|
|
2014-02-08 22:08:49 -05:00
|
|
|
%w(valid_commit valid_commit_with_alt_email big_commits select2_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|
|
2014-06-06 02:01:17 -04:00
|
|
|
Capybara::Poltergeist::Driver.new(app, js_errors: false, timeout: 90)
|
2013-09-12 18:30:49 -04:00
|
|
|
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-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
|
2012-09-10 07:27:11 -04:00
|
|
|
end
|