engine/spec/spec_helper.rb

38 lines
849 B
Ruby
Raw Normal View History

ENV['RAILS_ENV'] ||= 'test'
require 'rails/mongoid'
require File.join(File.dirname(__FILE__), 'dummy', 'config', 'environment.rb')
require 'rspec/rails'
require 'factory_girl'
require 'database_cleaner'
# 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 }
Locomotive.configure_for_test
RSpec.configure do |config|
config.include(Locomotive::RSpec::Matchers)
config.mock_with :mocha
config.before(:suite) do
Locomotive.configure_for_test(true)
end
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.orm = 'mongoid'
end
config.before(:each) do
DatabaseCleaner.clean
end
config.after(:suite) do
DatabaseCleaner.clean
end
2010-04-09 09:23:41 +00:00
end