Commit 178070c3 by vulehuan

uses database_cleaner

parent 382224cd
...@@ -53,6 +53,7 @@ group :development, :test do ...@@ -53,6 +53,7 @@ group :development, :test do
gem 'rspec-rails', "~> 2.14.0" gem 'rspec-rails', "~> 2.14.0"
gem 'faker', '1.1.2' gem 'faker', '1.1.2'
gem 'binding_of_caller' gem 'binding_of_caller'
gem "database_cleaner", "~> 1.2.0"
end end
group :development do group :development do
......
...@@ -22,12 +22,12 @@ RSpec.configure do |config| ...@@ -22,12 +22,12 @@ RSpec.configure do |config|
# config.mock_with :rr # config.mock_with :rr
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures" # config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your # If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false # examples within a transaction, remove the following line or assign false
# instead of true. # instead of true.
config.use_transactional_fixtures = true # config.use_transactional_fixtures = true
# If true, the base class of anonymous controllers will be inferred # If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of # automatically. This will be the default behavior in future versions of
......
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner[:mongoid].strategy = :truncation
end
config.before(:each, :js => true) do
DatabaseCleaner[:mongoid].strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment