database_cleaner 1.0.0.RC1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/Gemfile.lock +6 -0
  2. data/History.txt +11 -3
  3. data/README.markdown +39 -3
  4. data/VERSION.yml +2 -2
  5. data/examples/Gemfile +2 -0
  6. data/examples/Gemfile.lock +6 -0
  7. data/examples/config/redis.yml +8 -0
  8. data/examples/features/support/env.rb +8 -1
  9. data/examples/lib/mongoid_models.rb +1 -1
  10. data/examples/lib/ohm_models.rb +43 -0
  11. data/examples/lib/redis_models.rb +65 -0
  12. data/features/cleaning.feature +11 -9
  13. data/features/cleaning_default_strategy.feature +2 -0
  14. data/features/cleaning_multiple_orms.feature +19 -0
  15. data/features/step_definitions/database_cleaner_steps.rb +3 -2
  16. data/features/step_definitions/ohm_steps.rb +31 -0
  17. data/features/step_definitions/redis_steps.rb +31 -0
  18. data/lib/database_cleaner/active_record/base.rb +1 -7
  19. data/lib/database_cleaner/active_record/transaction.rb +4 -0
  20. data/lib/database_cleaner/base.rb +19 -3
  21. data/lib/database_cleaner/configuration.rb +5 -1
  22. data/lib/database_cleaner/mongoid/truncation.rb +2 -2
  23. data/lib/database_cleaner/moped/base.rb +35 -0
  24. data/lib/database_cleaner/moped/truncation.rb +4 -24
  25. data/lib/database_cleaner/moped/truncation_base.rb +34 -0
  26. data/lib/database_cleaner/ohm/truncation.rb +15 -0
  27. data/lib/database_cleaner/redis/base.rb +31 -0
  28. data/lib/database_cleaner/redis/truncation.rb +26 -0
  29. data/spec/database_cleaner/active_record/base_spec.rb +2 -19
  30. data/spec/database_cleaner/active_record/transaction_spec.rb +2 -0
  31. data/spec/database_cleaner/base_spec.rb +73 -7
  32. data/spec/database_cleaner/configuration_spec.rb +15 -1
  33. data/spec/database_cleaner/moped/moped_examples.rb +26 -0
  34. data/spec/database_cleaner/moped/truncation_spec.rb +75 -0
  35. data/spec/database_cleaner/ohm/truncation_spec.rb +70 -0
  36. data/spec/database_cleaner/redis/base_spec.rb +32 -0
  37. data/spec/database_cleaner/redis/truncation_spec.rb +63 -0
  38. metadata +20 -5
@@ -0,0 +1,31 @@
1
+ Given /^I have setup database cleaner to clean multiple databases using redis$/ do
2
+ #DatabaseCleaner
3
+ # require "#{File.dirname(__FILE__)}/../../../lib/redis_models"
4
+ #
5
+ # DatabaseCleaner[:redis, {:connection => ENV['REDIS_URL_ONE']} ].strategy = :truncation
6
+ # DatabaseCleaner[:redis, {:connection => ENV['REDIS_URL_TWO']} ].strategy = :truncation
7
+ end
8
+
9
+ When /^I create a widget using redis$/ do
10
+ RedisWidget.create!
11
+ end
12
+
13
+ Then /^I should see ([\d]+) widget using redis$/ do |widget_count|
14
+ RedisWidget.count.should == widget_count.to_i
15
+ end
16
+
17
+ When /^I create a widget in one db using redis$/ do
18
+ RedisWidgetUsingDatabaseOne.create!
19
+ end
20
+
21
+ When /^I create a widget in another db using redis$/ do
22
+ RedisWidgetUsingDatabaseTwo.create!
23
+ end
24
+
25
+ Then /^I should see ([\d]+) widget in one db using redis$/ do |widget_count|
26
+ RedisWidgetUsingDatabaseOne.count.should == widget_count.to_i
27
+ end
28
+
29
+ Then /^I should see ([\d]+) widget in another db using redis$/ do |widget_count|
30
+ RedisWidgetUsingDatabaseTwo.count.should == widget_count.to_i
31
+ end
@@ -38,10 +38,6 @@ module DatabaseCleaner
38
38
  end
39
39
  end
40
40
 
41
- def create_connection_class
42
- Class.new(::ActiveRecord::Base)
43
- end
44
-
45
41
  def connection_class
46
42
  @connection_class ||= if @db && !@db.is_a?(Symbol)
47
43
  @db
@@ -63,9 +59,7 @@ module DatabaseCleaner
63
59
  end
64
60
 
65
61
  def establish_connection
66
- strategy_class = create_connection_class
67
- strategy_class.send :establish_connection, connection_hash
68
- strategy_class
62
+ ::ActiveRecord::Base.establish_connection(connection_hash)
69
63
  end
70
64
 
71
65
  end
@@ -7,6 +7,10 @@ module DatabaseCleaner::ActiveRecord
7
7
  include ::DatabaseCleaner::Generic::Transaction
8
8
 
9
9
  def start
10
+ # Hack to make sure that the connection is properly setup for
11
+ # the clean code.
12
+ connection_class.connection.transaction{ }
13
+
10
14
  if connection_maintains_transaction_count?
11
15
  if connection_class.connection.respond_to?(:increment_open_transactions)
12
16
  connection_class.connection.increment_open_transactions
@@ -36,12 +36,22 @@ module DatabaseCleaner
36
36
 
37
37
  def clean_with(*args)
38
38
  strategy = create_strategy(*args)
39
+ set_strategy_db strategy, self.db
40
+
39
41
  strategy.clean
40
42
  strategy
41
43
  end
42
44
 
43
45
  alias clean_with! clean_with
44
46
 
47
+ def set_strategy_db(strategy, desired_db)
48
+ if strategy.respond_to? :db=
49
+ strategy.db = desired_db
50
+ elsif desired_db != :default
51
+ raise ArgumentError, "You must provide a strategy object that supports non default databases when you specify a database"
52
+ end
53
+ end
54
+
45
55
  def strategy=(args)
46
56
  strategy, *strategy_args = args
47
57
  if strategy.is_a?(Symbol)
@@ -52,7 +62,7 @@ module DatabaseCleaner
52
62
  raise ArgumentError, "You must provide a strategy object, or a symbol for a known strategy along with initialization params."
53
63
  end
54
64
 
55
- self.strategy_db = self.db
65
+ set_strategy_db @strategy, self.db
56
66
 
57
67
  @strategy
58
68
  end
@@ -120,8 +130,14 @@ module DatabaseCleaner
120
130
  :couch_potato
121
131
  elsif defined? ::Sequel
122
132
  :sequel
133
+ elsif defined? ::Moped
134
+ :moped
135
+ elsif defined? ::Ohm
136
+ :ohm
137
+ elsif defined? ::Redis
138
+ :redis
123
139
  else
124
- raise NoORMDetected, "No known ORM was detected! Is ActiveRecord, DataMapper, Sequel, MongoMapper, Mongoid, or CouchPotato loaded?"
140
+ raise NoORMDetected, "No known ORM was detected! Is ActiveRecord, DataMapper, Sequel, MongoMapper, Mongoid, Moped, or CouchPotato, Redis or Ohm loaded?"
125
141
  end
126
142
  end
127
143
  end
@@ -130,7 +146,7 @@ module DatabaseCleaner
130
146
  case orm
131
147
  when :active_record, :data_mapper, :sequel
132
148
  self.strategy = :transaction
133
- when :mongo_mapper, :mongoid, :couch_potato
149
+ when :mongo_mapper, :mongoid, :couch_potato, :moped, :ohm, :redis
134
150
  self.strategy = :truncation
135
151
  end
136
152
  end
@@ -11,7 +11,7 @@ module DatabaseCleaner
11
11
  # ghetto ordered hash.. maintains 1.8 compat and old API
12
12
  @connections ||= []
13
13
  end
14
-
14
+
15
15
  def [](orm,opts = {})
16
16
  raise NoORMDetected unless orm
17
17
  init_cleaners
@@ -113,6 +113,10 @@ module DatabaseCleaner
113
113
  DatabaseCleaner::CouchPotato
114
114
  when :sequel
115
115
  DatabaseCleaner::Sequel
116
+ when :ohm
117
+ DatabaseCleaner::Ohm
118
+ when :redis
119
+ DatabaseCleaner::Redis
116
120
  end
117
121
  end
118
122
  end
@@ -1,7 +1,7 @@
1
1
  require 'database_cleaner/mongoid/base'
2
2
  require 'database_cleaner/generic/truncation'
3
3
  require 'database_cleaner/mongo/truncation_mixin'
4
- require 'database_cleaner/moped/truncation'
4
+ require 'database_cleaner/moped/truncation_base'
5
5
  require 'mongoid/version'
6
6
 
7
7
  module DatabaseCleaner
@@ -22,7 +22,7 @@ module DatabaseCleaner
22
22
 
23
23
  else
24
24
 
25
- include ::DatabaseCleaner::Moped::Truncation
25
+ include ::DatabaseCleaner::Moped::TruncationBase
26
26
 
27
27
  private
28
28
 
@@ -0,0 +1,35 @@
1
+ require 'database_cleaner/generic/base'
2
+
3
+ module DatabaseCleaner
4
+ module Moped
5
+ def self.available_strategies
6
+ %w[truncation]
7
+ end
8
+
9
+ module Base
10
+ include ::DatabaseCleaner::Generic::Base
11
+
12
+ def db=(desired_db)
13
+ @db = desired_db
14
+ end
15
+
16
+ def db
17
+ @db || :default
18
+ end
19
+
20
+ def host_port=(desired_host)
21
+ @host = desired_host
22
+ end
23
+
24
+ def host
25
+ @host || '127.0.0.1:27017'
26
+ end
27
+
28
+ private
29
+
30
+ def session
31
+ ::Moped::Session.new([host], database: db)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,29 +1,9 @@
1
+ require 'database_cleaner/moped/truncation_base'
2
+
1
3
  module DatabaseCleaner
2
4
  module Moped
3
- module Truncation
4
-
5
- def clean
6
- if @only
7
- collections.each { |c| session[c].find.remove_all if @only.include?(c) }
8
- else
9
- collections.each { |c| session[c].find.remove_all unless @tables_to_exclude.include?(c) }
10
- end
11
- true
12
- end
13
-
14
- private
15
-
16
- def collections
17
- if db != :default
18
- session.use(db)
19
- end
20
-
21
- session['system.namespaces'].find(:name => { '$not' => /system|\$/ }).to_a.map do |collection|
22
- _, name = collection['name'].split('.', 2)
23
- name
24
- end
25
- end
26
-
5
+ class Truncation
6
+ include ::DatabaseCleaner::Moped::TruncationBase
27
7
  end
28
8
  end
29
9
  end
@@ -0,0 +1,34 @@
1
+ require 'database_cleaner/moped/base'
2
+ require 'database_cleaner/generic/truncation'
3
+
4
+ module DatabaseCleaner
5
+ module Moped
6
+ module TruncationBase
7
+ include ::DatabaseCleaner::Moped::Base
8
+ include ::DatabaseCleaner::Generic::Truncation
9
+
10
+ def clean
11
+ if @only
12
+ collections.each { |c| session[c].find.remove_all if @only.include?(c) }
13
+ else
14
+ collections.each { |c| session[c].find.remove_all unless @tables_to_exclude.include?(c) }
15
+ end
16
+ true
17
+ end
18
+
19
+ private
20
+
21
+ def collections
22
+ if db != :default
23
+ session.use(db)
24
+ end
25
+
26
+ session['system.namespaces'].find(:name => { '$not' => /system|\$/ }).to_a.map do |collection|
27
+ _, name = collection['name'].split('.', 2)
28
+ name
29
+ end
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,15 @@
1
+ require 'database_cleaner/redis/truncation'
2
+
3
+ module DatabaseCleaner
4
+ module Ohm
5
+ class Truncation < ::DatabaseCleaner::Redis::Truncation
6
+
7
+ private
8
+
9
+ def default_redis
10
+ ::Ohm.redis
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,31 @@
1
+ require 'database_cleaner/generic/base'
2
+
3
+ module DatabaseCleaner
4
+ module Redis
5
+ def self.available_strategies
6
+ %w{truncation}
7
+ end
8
+
9
+ module Base
10
+ include ::DatabaseCleaner::Generic::Base
11
+
12
+ def db=(desired_db)
13
+ @db = desired_db
14
+ end
15
+
16
+ def db
17
+ @db || :default
18
+ end
19
+
20
+ alias url db
21
+
22
+ private
23
+
24
+ def connection
25
+ @connection ||= url == :default ? ::Redis.connect : ::Redis.connect(:url => url)
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+
@@ -0,0 +1,26 @@
1
+ require 'database_cleaner/redis/base'
2
+ require 'database_cleaner/generic/truncation'
3
+
4
+ module DatabaseCleaner
5
+ module Redis
6
+ class Truncation
7
+ include ::DatabaseCleaner::Redis::Base
8
+ include ::DatabaseCleaner::Generic::Truncation
9
+
10
+ def clean
11
+ if @only
12
+ @only.each do |term|
13
+ connection.keys(term).each { |k| connection.del k }
14
+ end
15
+ elsif @tables_to_exclude
16
+ keys_except = []
17
+ @tables_to_exclude.each { |term| keys_except += connection.keys(term) }
18
+ connection.keys.each { |k| connection.del(k) unless keys_except.include?(k) }
19
+ else
20
+ connection.flushdb
21
+ end
22
+ connection.quit unless url == :default
23
+ end
24
+ end
25
+ end
26
+ end
@@ -119,16 +119,6 @@ my_db:
119
119
  end
120
120
  end
121
121
 
122
- describe "create_connection_class" do
123
- it "should return a class" do
124
- subject.create_connection_class.should be_a(Class)
125
- end
126
-
127
- it "should return a class extending ::ActiveRecord::Base" do
128
- subject.create_connection_class.ancestors.should include(::ActiveRecord::Base)
129
- end
130
- end
131
-
132
122
  describe "connection_class" do
133
123
  it { expect { subject.connection_class }.to_not raise_error }
134
124
  it "should default to ActiveRecord::Base" do
@@ -158,16 +148,9 @@ my_db:
158
148
  before { ::ActiveRecord::Base.stub!(:respond_to?).and_return(false) }
159
149
  before { subject.stub(:connection_hash).and_return(hash) }
160
150
 
161
- it "should create connection_class if it doesnt exist if connection_hash is set" do
162
- subject.should_receive(:create_connection_class).and_return(mock('class').as_null_object)
163
- subject.connection_class
164
- end
165
-
166
- it "should configure the class from create_connection_class if connection_hash is set" do
167
- strategy_class = mock('strategy_class')
168
- strategy_class.should_receive(:establish_connection).with(hash)
151
+ it "establish a connection using ActiveRecord::Base" do
152
+ ::ActiveRecord::Base.should_receive(:establish_connection).with(hash)
169
153
 
170
- subject.should_receive(:create_connection_class).and_return(strategy_class)
171
154
  subject.connection_class
172
155
  end
173
156
  end
@@ -15,6 +15,7 @@ module DatabaseCleaner
15
15
  [:begin_transaction, :begin_db_transaction].each do |begin_transaction_method|
16
16
  context "using #{begin_transaction_method}" do
17
17
  before do
18
+ connection.stub(:transaction)
18
19
  connection.stub(begin_transaction_method)
19
20
  connection.stub(:respond_to?).with(:begin_transaction).and_return(:begin_transaction == begin_transaction_method)
20
21
  end
@@ -35,6 +36,7 @@ module DatabaseCleaner
35
36
  connection.stub(:respond_to?).with(:increment_open_transactions).and_return(true)
36
37
  connection.stub(:increment_open_transactions)
37
38
  connection.should_receive(begin_transaction_method)
39
+ connection.should_receive(:transaction)
38
40
  Transaction.new.start
39
41
  end
40
42
  end
@@ -18,6 +18,9 @@ module DatabaseCleaner
18
18
  Temp_MO = ::Mongoid if defined?(::Mongoid) and not defined?(Temp_MO)
19
19
  Temp_CP = ::CouchPotato if defined?(::CouchPotato) and not defined?(Temp_CP)
20
20
  Temp_SQ = ::Sequel if defined?(::Sequel) and not defined?(Temp_SQ)
21
+ Temp_MP = ::Moped if defined?(::Moped) and not defined?(Temp_MP)
22
+ Temp_RS = ::Redis if defined?(::Redis) and not defined?(Temp_RS)
23
+ Temp_OH = ::Ohm if defined?(::Ohm) and not defined?(Temp_OH)
21
24
  end
22
25
 
23
26
  #Remove all ORM mocks and restore from cache
@@ -28,6 +31,9 @@ module DatabaseCleaner
28
31
  Object.send(:remove_const, 'Mongoid') if defined?(::Mongoid)
29
32
  Object.send(:remove_const, 'CouchPotato') if defined?(::CouchPotato)
30
33
  Object.send(:remove_const, 'Sequel') if defined?(::Sequel)
34
+ Object.send(:remove_const, 'Moped') if defined?(::Moped)
35
+ Object.send(:remove_const, 'Ohm') if defined?(::Ohm)
36
+ Object.send(:remove_const, 'Redis') if defined?(::Redis)
31
37
 
32
38
 
33
39
  # Restore ORMs
@@ -36,6 +42,9 @@ module DatabaseCleaner
36
42
  ::MongoMapper = Temp_MM if defined? Temp_MM
37
43
  ::Mongoid = Temp_MO if defined? Temp_MO
38
44
  ::CouchPotato = Temp_CP if defined? Temp_CP
45
+ ::Moped = Temp_MP if defined? Temp_MP
46
+ ::Ohm = Temp_OH if defined? Temp_OH
47
+ ::Redis = Temp_RS if defined? Temp_RS
39
48
  end
40
49
 
41
50
  #reset the orm mocks
@@ -46,8 +55,11 @@ module DatabaseCleaner
46
55
  Object.send(:remove_const, 'Mongoid') if defined?(::Mongoid)
47
56
  Object.send(:remove_const, 'CouchPotato') if defined?(::CouchPotato)
48
57
  Object.send(:remove_const, 'Sequel') if defined?(::Sequel)
58
+ Object.send(:remove_const, 'Moped') if defined?(::Moped)
59
+ Object.send(:remove_const, 'Ohm') if defined?(::Ohm)
60
+ Object.send(:remove_const, 'Redis') if defined?(::Redis)
49
61
  end
50
-
62
+
51
63
  let(:cleaner) { DatabaseCleaner::Base.new :autodetect }
52
64
 
53
65
  it "should raise an error when no ORM is detected" do
@@ -61,6 +73,9 @@ module DatabaseCleaner
61
73
  Object.const_set('Mongoid', 'Mongoid mock')
62
74
  Object.const_set('CouchPotato', 'Couching mock potatos')
63
75
  Object.const_set('Sequel', 'Sequel mock')
76
+ Object.const_set('Moped', 'Moped mock')
77
+ Object.const_set('Ohm', 'Ohm mock')
78
+ Object.const_set('Redis', 'Redis mock')
64
79
 
65
80
  cleaner.orm.should == :active_record
66
81
  cleaner.should be_auto_detected
@@ -72,6 +87,9 @@ module DatabaseCleaner
72
87
  Object.const_set('Mongoid', 'Mongoid mock')
73
88
  Object.const_set('CouchPotato', 'Couching mock potatos')
74
89
  Object.const_set('Sequel', 'Sequel mock')
90
+ Object.const_set('Moped', 'Moped mock')
91
+ Object.const_set('Ohm', 'Ohm mock')
92
+ Object.const_set('Redis', 'Redis mock')
75
93
 
76
94
  cleaner.orm.should == :data_mapper
77
95
  cleaner.should be_auto_detected
@@ -82,6 +100,9 @@ module DatabaseCleaner
82
100
  Object.const_set('Mongoid', 'Mongoid mock')
83
101
  Object.const_set('CouchPotato', 'Couching mock potatos')
84
102
  Object.const_set('Sequel', 'Sequel mock')
103
+ Object.const_set('Moped', 'Moped mock')
104
+ Object.const_set('Ohm', 'Ohm mock')
105
+ Object.const_set('Redis', 'Redis mock')
85
106
 
86
107
  cleaner.orm.should == :mongo_mapper
87
108
  cleaner.should be_auto_detected
@@ -91,6 +112,9 @@ module DatabaseCleaner
91
112
  Object.const_set('Mongoid', 'Mongoid mock')
92
113
  Object.const_set('CouchPotato', 'Couching mock potatos')
93
114
  Object.const_set('Sequel', 'Sequel mock')
115
+ Object.const_set('Moped', 'Moped mock')
116
+ Object.const_set('Ohm', 'Ohm mock')
117
+ Object.const_set('Redis', 'Redis mock')
94
118
 
95
119
  cleaner.orm.should == :mongoid
96
120
  cleaner.should be_auto_detected
@@ -99,17 +123,45 @@ module DatabaseCleaner
99
123
  it "should detect CouchPotato fifth" do
100
124
  Object.const_set('CouchPotato', 'Couching mock potatos')
101
125
  Object.const_set('Sequel', 'Sequel mock')
126
+ Object.const_set('Moped', 'Moped mock')
127
+ Object.const_set('Ohm', 'Ohm mock')
128
+ Object.const_set('Redis', 'Redis mock')
102
129
 
103
130
  cleaner.orm.should == :couch_potato
104
131
  cleaner.should be_auto_detected
105
132
  end
106
-
107
- it "should detect Sequel last" do
133
+
134
+ it "should detect Sequel sixth" do
108
135
  Object.const_set('Sequel', 'Sequel mock')
136
+ Object.const_set('Moped', 'Moped mock')
137
+ Object.const_set('Ohm', 'Ohm mock')
138
+ Object.const_set('Redis', 'Redis mock')
109
139
 
110
140
  cleaner.orm.should == :sequel
111
141
  cleaner.should be_auto_detected
112
142
  end
143
+
144
+ it 'detects Ohm seventh' do
145
+ Object.const_set('Ohm', 'Ohm mock')
146
+ Object.const_set('Redis', 'Redis mock')
147
+
148
+ cleaner.orm.should == :ohm
149
+ cleaner.should be_auto_detected
150
+ end
151
+
152
+ it 'detects Redis last' do
153
+ Object.const_set('Redis', 'Redis mock')
154
+
155
+ cleaner.orm.should == :redis
156
+ cleaner.should be_auto_detected
157
+ end
158
+
159
+ it 'detects Moped seventh' do
160
+ Object.const_set('Moped', 'Moped mock')
161
+
162
+ cleaner.orm.should == :moped
163
+ cleaner.should be_auto_detected
164
+ end
113
165
  end
114
166
 
115
167
  describe "orm_module" do
@@ -160,7 +212,7 @@ module DatabaseCleaner
160
212
  cleaner = ::DatabaseCleaner::Base.new "mongoid"
161
213
  cleaner.orm.should == :mongoid
162
214
  end
163
-
215
+
164
216
  it "is autodetected if orm is not provided" do
165
217
  cleaner = ::DatabaseCleaner::Base.new
166
218
  cleaner.should be_auto_detected
@@ -317,7 +369,7 @@ module DatabaseCleaner
317
369
 
318
370
  it "should attempt to set strategy db" do
319
371
  subject.stub(:db).and_return(:my_db)
320
- subject.should_receive(:strategy_db=).with(:my_db)
372
+ subject.should_receive(:set_strategy_db).with(mock_strategy, :my_db)
321
373
  subject.strategy = mock_strategy
322
374
  end
323
375
 
@@ -330,8 +382,7 @@ module DatabaseCleaner
330
382
  describe "strategy" do
331
383
  subject { ::DatabaseCleaner::Base.new :a_orm }
332
384
 
333
- it "returns a null strategy when strategy no set and undetectable" do
334
- subject.instance_values["@strategy"] = nil
385
+ it "returns a null strategy when strategy is not set and undetectable" do
335
386
  subject.strategy.should == DatabaseCleaner::NullStrategy
336
387
  end
337
388
 
@@ -487,6 +538,21 @@ module DatabaseCleaner
487
538
  cleaner = DatabaseCleaner::Base.new(:couch_potato)
488
539
  cleaner.strategy.should be_instance_of DatabaseCleaner::CouchPotato::Truncation
489
540
  end
541
+
542
+ it 'sets strategy to :truncation for Moped' do
543
+ cleaner = DatabaseCleaner::Base.new(:moped)
544
+ cleaner.strategy.should be_instance_of DatabaseCleaner::Moped::Truncation
545
+ end
546
+
547
+ it 'sets strategy to :truncation for Ohm' do
548
+ cleaner = DatabaseCleaner::Base.new(:ohm)
549
+ cleaner.strategy.should be_instance_of DatabaseCleaner::Ohm::Truncation
550
+ end
551
+
552
+ it 'sets strategy to :truncation for Redis' do
553
+ cleaner = DatabaseCleaner::Base.new(:redis)
554
+ cleaner.strategy.should be_instance_of DatabaseCleaner::Redis::Truncation
555
+ end
490
556
  end
491
557
 
492
558
  end