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-03-30 19:50:52 +00:00
|
|
|
Capybara.register_driver :poltergeist do |app|
|
|
|
|
Capybara::Poltergeist::Driver.new(app, :phantomjs_logger => File.open('/dev/null'))
|
|
|
|
end
|
2014-03-23 00:22:25 +00:00
|
|
|
|
|
|
|
Capybara.javascript_driver = :poltergeist
|
|
|
|
|
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
|
|
|
|
Capybara.current_driver = :poltergeist
|
|
|
|
else
|
|
|
|
Capybara.use_default_driver
|
|
|
|
end
|
|
|
|
end
|
2014-03-23 00:22:25 +00:00
|
|
|
end
|