2013-05-27 16:26:03 +00:00
|
|
|
if ENV['COVERAGE']
|
|
|
|
require 'simplecov'
|
|
|
|
SimpleCov.start 'rails' do
|
|
|
|
add_group "Decorators", "app/decorators"
|
|
|
|
end
|
2012-04-09 18:07:34 +00:00
|
|
|
end
|
2012-04-09 16:23:28 +00:00
|
|
|
|
2011-11-21 21:36:42 +00:00
|
|
|
ENV["RAILS_ENV"] ||= 'test'
|
2013-12-09 19:26:08 +00:00
|
|
|
ENV['CARRIERWAVE_STORAGE_DIR_PREFIX'] ||= 'uploads/test/'
|
2013-05-27 16:28:01 +00:00
|
|
|
|
2011-11-21 21:36:42 +00:00
|
|
|
require File.expand_path("../../config/environment", __FILE__)
|
2013-05-27 16:28:01 +00:00
|
|
|
|
2011-11-21 21:36:42 +00:00
|
|
|
require 'rspec/rails'
|
2012-11-18 23:19:42 +00:00
|
|
|
require 'capybara/rspec'
|
2013-05-27 17:53:52 +00:00
|
|
|
require 'capybara/poltergeist'
|
2013-07-05 17:50:42 +00:00
|
|
|
require 'sidekiq/testing'
|
2012-11-18 23:19:42 +00:00
|
|
|
|
2012-03-08 14:00:10 +00:00
|
|
|
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
2013-05-27 16:28:01 +00:00
|
|
|
Dir[Rails.root.join("spec/shared/**/*.rb")].each { |f| require f }
|
2011-11-21 21:36:42 +00:00
|
|
|
|
2013-05-27 17:53:52 +00:00
|
|
|
Capybara.javascript_driver = :poltergeist
|
|
|
|
|
2013-05-27 21:44:12 +00:00
|
|
|
OmniAuth.config.test_mode = true
|
|
|
|
|
2013-12-09 18:16:09 +00:00
|
|
|
CarrierWave.configure do |config|
|
|
|
|
config.storage = :file
|
|
|
|
config.enable_processing = false
|
|
|
|
end
|
|
|
|
|
2011-11-21 21:36:42 +00:00
|
|
|
RSpec.configure do |config|
|
|
|
|
config.mock_with :rspec
|
2012-11-18 23:19:42 +00:00
|
|
|
config.use_transactional_fixtures = false
|
|
|
|
config.infer_base_class_for_anonymous_controllers = false
|
2013-06-06 15:06:02 +00:00
|
|
|
config.order = "random"
|
2011-11-21 21:36:42 +00:00
|
|
|
|
2013-05-27 17:54:11 +00:00
|
|
|
config.include FactoryGirl::Syntax::Methods
|
2013-09-23 17:05:36 +00:00
|
|
|
config.include Asciinema::FixtureHelpers
|
|
|
|
config.include Asciinema::FeatureHelpers
|
|
|
|
config.include Asciinema::ControllerMacros, :type => :controller
|
2013-05-27 16:28:01 +00:00
|
|
|
|
|
|
|
config.before(:suite) do
|
|
|
|
DatabaseCleaner.clean_with(:truncation)
|
|
|
|
end
|
|
|
|
|
2012-12-09 15:27:36 +00:00
|
|
|
config.before(:each) do
|
|
|
|
DatabaseCleaner.strategy = :transaction
|
|
|
|
end
|
|
|
|
|
|
|
|
config.before(:each, :js => true) do
|
|
|
|
DatabaseCleaner.strategy = :truncation
|
|
|
|
end
|
|
|
|
|
2012-11-18 23:19:42 +00:00
|
|
|
config.before(:each) do
|
|
|
|
DatabaseCleaner.start
|
|
|
|
end
|
2011-11-21 21:36:42 +00:00
|
|
|
|
2012-11-18 23:19:42 +00:00
|
|
|
config.after(:each) do
|
|
|
|
DatabaseCleaner.clean
|
|
|
|
end
|
2011-11-21 21:36:42 +00:00
|
|
|
end
|