2014-03-23 00:22:25 +00:00
|
|
|
ENV["RAILS_ENV"] ||= 'test'
|
|
|
|
|
2014-03-25 21:58:51 +00:00
|
|
|
require 'codeclimate-test-reporter'
|
2014-03-23 00:22:25 +00:00
|
|
|
require 'simplecov'
|
2014-03-25 21:58:51 +00:00
|
|
|
CodeClimate::TestReporter.start
|
2014-03-23 00:22:25 +00:00
|
|
|
SimpleCov.start 'rails'
|
|
|
|
|
|
|
|
require File.expand_path("../../config/environment", __FILE__)
|
|
|
|
require 'rspec/rails'
|
|
|
|
require 'capybara/rspec'
|
|
|
|
require 'capybara/poltergeist'
|
|
|
|
|
2014-08-10 20:55:44 +00:00
|
|
|
Capybara.default_wait_time = 30
|
2014-03-30 19:50:52 +00:00
|
|
|
Capybara.register_driver :poltergeist do |app|
|
2014-04-06 14:23:17 +00:00
|
|
|
Capybara::Poltergeist::Driver.new(app,
|
2014-08-10 20:55:44 +00:00
|
|
|
timeout: 30,
|
2014-04-06 14:23:17 +00:00
|
|
|
phantomjs_logger: File.open('/dev/null')
|
|
|
|
)
|
2014-03-30 19:50:52 +00:00
|
|
|
end
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-05-16 22:54:41 +00:00
|
|
|
Capybara.javascript_driver = :selenium
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-03-30 19:50:52 +00:00
|
|
|
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
|
|
|
|
2014-03-23 00:22:25 +00:00
|
|
|
RSpec.configure do |config|
|
|
|
|
config.include FactoryGirl::Syntax::Methods
|
2014-03-30 19:50:52 +00:00
|
|
|
config.include Controllers::JsonHelpers, type: :controller
|
|
|
|
config.include Features::FormHelpers, type: :feature
|
|
|
|
config.include Features::SessionHelpers, type: :feature
|
|
|
|
|
2014-03-23 00:22:25 +00:00
|
|
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
2014-03-30 19:50:52 +00:00
|
|
|
config.order = 'random'
|
|
|
|
config.use_transactional_fixtures = false
|
|
|
|
|
|
|
|
config.before(:each) do
|
|
|
|
if example.metadata[:type] == :feature
|
2014-10-11 07:44:02 +00:00
|
|
|
Capybara.current_driver = :poltergeist
|
2014-03-30 19:50:52 +00:00
|
|
|
else
|
|
|
|
Capybara.use_default_driver
|
|
|
|
end
|
|
|
|
end
|
2014-03-23 00:22:25 +00:00
|
|
|
end
|