From 9558b11d697b38f90f6b2923dae207e735db5cad Mon Sep 17 00:00:00 2001 From: Nicolae Claudius Date: Thu, 19 Sep 2013 14:55:53 +0300 Subject: [PATCH] faster tests with database_rewinder --- Gemfile | 2 +- Gemfile.lock | 4 ++-- spec/support/database_cleaner.rb | 16 ---------------- spec/support/database_rewinder.rb | 9 +++++++++ 4 files changed, 12 insertions(+), 19 deletions(-) delete mode 100644 spec/support/database_cleaner.rb create mode 100644 spec/support/database_rewinder.rb diff --git a/Gemfile b/Gemfile index 2d3e770..d23b250 100644 --- a/Gemfile +++ b/Gemfile @@ -68,7 +68,7 @@ end group :test do gem 'capybara', '~> 2.1.0' - gem 'database_cleaner', '~> 1.1.1' + gem 'database_rewinder', '~> 0.0.1' # gem 'rb-inotify', '~> 0.9.0' # gem 'libnotify', '~> 0.8.1' # gem 'guard', '1.8.2' diff --git a/Gemfile.lock b/Gemfile.lock index ac40167..3d4768f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -128,7 +128,7 @@ GEM sass (~> 3.1) concerned_with (0.1.0) dalli (2.6.4) - database_cleaner (1.1.1) + database_rewinder (0.0.1) debase (0.0.7) debugger-ruby_core_source debug_inspector (0.0.2) @@ -285,7 +285,7 @@ DEPENDENCIES compass-rails! concerned_with (~> 0.1.0) dalli (~> 2.6.2) - database_cleaner (~> 1.1.1) + database_rewinder (~> 0.0.1) debase (~> 0.0.7) detect_timezone_rails (~> 0.0.3) devise (~> 3.0.3) diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb deleted file mode 100644 index acfced8..0000000 --- a/spec/support/database_cleaner.rb +++ /dev/null @@ -1,16 +0,0 @@ -RSpec.configure do |config| - - config.before(:suite) do - DatabaseCleaner.strategy = :transaction - DatabaseCleaner.clean_with(:truncation) - end - - config.before(:each) do - DatabaseCleaner.start - end - - config.after(:each) do - DatabaseCleaner.clean - end - -end diff --git a/spec/support/database_rewinder.rb b/spec/support/database_rewinder.rb new file mode 100644 index 0000000..bbab032 --- /dev/null +++ b/spec/support/database_rewinder.rb @@ -0,0 +1,9 @@ +RSpec.configure do |config| + config.before :suite do + DatabaseRewinder.clean_all + end + + config.after do + DatabaseRewinder.clean + end +end \ No newline at end of file