asciinema.org/spec/spec_helper.rb

52 lines
1.1 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'
require 'rspec/autorun'
2012-11-18 23:19:42 +00:00
require 'capybara/rspec'
require 'capybara/poltergeist'
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
GirlFriday::Queue.immediate!
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
config.include FactoryGirl::Syntax::Methods
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