2012-02-16 15:17:30 +00:00
|
|
|
ENV['RAILS_ENV'] ||= 'test'
|
2011-08-14 19:16:59 +00:00
|
|
|
|
2011-11-20 10:39:46 +00:00
|
|
|
require 'rails/mongoid'
|
|
|
|
require File.join(File.dirname(__FILE__), 'dummy', 'config', 'environment.rb')
|
|
|
|
require 'rspec/rails'
|
|
|
|
require 'factory_girl'
|
2012-02-16 15:17:30 +00:00
|
|
|
require 'database_cleaner'
|
2011-08-14 19:16:59 +00:00
|
|
|
|
2011-11-20 10:39:46 +00:00
|
|
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
|
|
# in spec/support/ and its subdirectories.
|
2011-11-20 11:25:01 +00:00
|
|
|
Dir[File.join(File.dirname(__FILE__), 'support', '**', '*.rb')].each { |f| require f }
|
2011-08-13 23:24:02 +00:00
|
|
|
|
2011-11-20 10:39:46 +00:00
|
|
|
Locomotive.configure_for_test
|
2011-08-13 23:24:02 +00:00
|
|
|
|
2011-11-20 10:39:46 +00:00
|
|
|
RSpec.configure do |config|
|
2011-08-13 23:24:02 +00:00
|
|
|
|
2011-11-20 10:39:46 +00:00
|
|
|
config.include(Locomotive::RSpec::Matchers)
|
2011-08-13 23:24:02 +00:00
|
|
|
|
2011-11-20 10:39:46 +00:00
|
|
|
config.mock_with :mocha
|
2011-04-28 21:47:01 +00:00
|
|
|
|
2011-11-25 12:59:44 +00:00
|
|
|
config.before(:suite) do
|
|
|
|
Locomotive.configure_for_test(true)
|
|
|
|
end
|
|
|
|
|
2011-11-20 10:39:46 +00:00
|
|
|
config.before(:suite) do
|
|
|
|
DatabaseCleaner.strategy = :truncation
|
|
|
|
DatabaseCleaner.orm = 'mongoid'
|
|
|
|
end
|
2010-12-14 17:00:12 +00:00
|
|
|
|
2011-11-20 10:39:46 +00:00
|
|
|
config.before(:each) do
|
2012-01-29 08:41:53 +00:00
|
|
|
DatabaseCleaner.clean
|
2011-08-13 23:24:02 +00:00
|
|
|
end
|
2012-02-16 15:17:30 +00:00
|
|
|
|
|
|
|
config.after(:suite) do
|
|
|
|
DatabaseCleaner.clean
|
|
|
|
end
|
2010-04-09 09:23:41 +00:00
|
|
|
end
|