asciinema.org/spec/spec_helper.rb

54 lines
1.2 KiB
Ruby
Raw Normal View History

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
ENV["RAILS_ENV"] ||= 'test'
2013-05-27 16:28:01 +00:00
require File.expand_path("../../config/environment", __FILE__)
2013-05-27 16:28:01 +00:00
require 'rspec/rails'
2012-11-18 23:19:42 +00:00
require 'capybara/rspec'
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 }
Capybara.javascript_driver = :poltergeist
2013-05-27 21:44:12 +00:00
OmniAuth.config.test_mode = true
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"
config.include FactoryGirl::Syntax::Methods
2013-05-27 19:25:29 +00:00
config.include AsciiIo::FeatureHelpers
2013-05-27 16:28:01 +00:00
config.include AsciiIo::ControllerMacros, :type => :controller
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
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
2012-11-18 23:19:42 +00:00
config.after(:each) do
DatabaseCleaner.clean
end
end