database_cleaner 1.6.2 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile.lock +3 -3
  3. data/History.rdoc +23 -0
  4. data/README.markdown +24 -1
  5. data/VERSION.yml +2 -2
  6. data/lib/database_cleaner.rb +6 -2
  7. data/lib/database_cleaner/active_record/base.rb +1 -1
  8. data/lib/database_cleaner/active_record/deletion.rb +9 -7
  9. data/lib/database_cleaner/base.rb +2 -0
  10. data/lib/database_cleaner/safeguard.rb +72 -0
  11. metadata +6 -86
  12. data/examples/Gemfile +0 -1
  13. data/examples/Gemfile.lock +0 -1
  14. data/examples/config/database.yml.example +0 -8
  15. data/examples/config/redis.yml +0 -8
  16. data/examples/db/sqlite_databases_go_here +0 -0
  17. data/examples/features/example.feature +0 -11
  18. data/examples/features/example_multiple_db.feature +0 -23
  19. data/examples/features/example_multiple_orm.feature +0 -22
  20. data/examples/features/step_definitions/activerecord_steps.rb +0 -31
  21. data/examples/features/step_definitions/couchpotato_steps.rb +0 -31
  22. data/examples/features/step_definitions/datamapper_steps.rb +0 -37
  23. data/examples/features/step_definitions/mongoid_steps.rb +0 -23
  24. data/examples/features/step_definitions/mongomapper_steps.rb +0 -31
  25. data/examples/features/step_definitions/neo4j_steps.rb +0 -23
  26. data/examples/features/step_definitions/ohm_steps.rb +0 -31
  27. data/examples/features/step_definitions/redis_steps.rb +0 -31
  28. data/examples/features/step_definitions/translation_steps.rb +0 -55
  29. data/examples/features/support/env.rb +0 -61
  30. data/examples/lib/activerecord_models.rb +0 -41
  31. data/examples/lib/couchpotato_models.rb +0 -61
  32. data/examples/lib/datamapper_models.rb +0 -50
  33. data/examples/lib/mongoid_models.rb +0 -44
  34. data/examples/lib/mongomapper_models.rb +0 -51
  35. data/examples/lib/neo4j_models.rb +0 -17
  36. data/examples/lib/ohm_models.rb +0 -43
  37. data/examples/lib/redis_models.rb +0 -65
  38. data/examples/lib/sequel_models.rb +0 -9
  39. data/features/cleaning.feature +0 -30
  40. data/features/cleaning_default_strategy.feature +0 -23
  41. data/features/cleaning_multiple_dbs.feature +0 -22
  42. data/features/cleaning_multiple_orms.feature +0 -67
  43. data/features/step_definitions/database_cleaner_steps.rb +0 -33
  44. data/features/support/env.rb +0 -4
  45. data/features/support/feature_runner.rb +0 -39
  46. data/spec/database_cleaner/active_record/base_spec.rb +0 -188
  47. data/spec/database_cleaner/active_record/transaction_spec.rb +0 -176
  48. data/spec/database_cleaner/active_record/truncation/mysql2_spec.rb +0 -38
  49. data/spec/database_cleaner/active_record/truncation/mysql_spec.rb +0 -38
  50. data/spec/database_cleaner/active_record/truncation/postgresql_spec.rb +0 -75
  51. data/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb +0 -40
  52. data/spec/database_cleaner/active_record/truncation/sqlite3_spec.rb +0 -40
  53. data/spec/database_cleaner/active_record/truncation_spec.rb +0 -180
  54. data/spec/database_cleaner/base_spec.rb +0 -617
  55. data/spec/database_cleaner/configuration_spec.rb +0 -345
  56. data/spec/database_cleaner/couch_potato/truncation_spec.rb +0 -41
  57. data/spec/database_cleaner/data_mapper/base_spec.rb +0 -30
  58. data/spec/database_cleaner/data_mapper/transaction_spec.rb +0 -23
  59. data/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb +0 -41
  60. data/spec/database_cleaner/data_mapper/truncation_spec.rb +0 -11
  61. data/spec/database_cleaner/generic/base_spec.rb +0 -61
  62. data/spec/database_cleaner/generic/truncation_spec.rb +0 -118
  63. data/spec/database_cleaner/mongo/mongo_examples.rb +0 -26
  64. data/spec/database_cleaner/mongo/truncation_spec.rb +0 -72
  65. data/spec/database_cleaner/mongo_mapper/base_spec.rb +0 -33
  66. data/spec/database_cleaner/mongo_mapper/mongo_examples.rb +0 -8
  67. data/spec/database_cleaner/mongo_mapper/truncation_spec.rb +0 -74
  68. data/spec/database_cleaner/moped/moped_examples.rb +0 -32
  69. data/spec/database_cleaner/moped/truncation_spec.rb +0 -80
  70. data/spec/database_cleaner/neo4j/base_spec.rb +0 -43
  71. data/spec/database_cleaner/neo4j/transaction_spec.rb +0 -25
  72. data/spec/database_cleaner/null_strategy_spec.rb +0 -28
  73. data/spec/database_cleaner/ohm/truncation_spec.rb +0 -70
  74. data/spec/database_cleaner/redis/base_spec.rb +0 -43
  75. data/spec/database_cleaner/redis/truncation_spec.rb +0 -63
  76. data/spec/database_cleaner/sequel/base_spec.rb +0 -32
  77. data/spec/database_cleaner/sequel/deletion_spec.rb +0 -58
  78. data/spec/database_cleaner/sequel/transaction_spec.rb +0 -21
  79. data/spec/database_cleaner/sequel/truncation/sqlite3_spec.rb +0 -0
  80. data/spec/database_cleaner/sequel/truncation_spec.rb +0 -182
  81. data/spec/database_cleaner/shared_strategy.rb +0 -15
  82. data/spec/rcov.opts +0 -1
  83. data/spec/spec_helper.rb +0 -21
  84. data/spec/support/active_record/database_setup.rb +0 -6
  85. data/spec/support/active_record/migrations/20150101010000_create_users.rb +0 -14
  86. data/spec/support/active_record/migrations/20150101020000_create_agents.rb +0 -14
  87. data/spec/support/active_record/mysql2_setup.rb +0 -39
  88. data/spec/support/active_record/mysql_setup.rb +0 -38
  89. data/spec/support/active_record/postgresql_setup.rb +0 -48
  90. data/spec/support/active_record/schema_setup.rb +0 -17
  91. data/spec/support/active_record/sqlite3_setup.rb +0 -40
  92. data/spec/support/data_mapper/schema_setup.rb +0 -15
  93. data/spec/support/data_mapper/sqlite3_setup.rb +0 -39
@@ -1,345 +0,0 @@
1
- require 'spec_helper'
2
- module ArrayHelper
3
- def zipmap(array, vals)
4
- Hash[*(array.zip(vals).flatten)]
5
- end
6
- module_function :zipmap
7
- end
8
-
9
- module DatabaseCleaner
10
- class << self
11
- def reset
12
- @cleaners = nil
13
- @connections = nil
14
- end
15
- # hackey, hack.. connections needs to stick around until I can properly deprecate the API
16
- def connections_stub(array)
17
- @cleaners = ArrayHelper.zipmap((1..array.size).to_a, array)
18
- @connections = array
19
- end
20
- end
21
- end
22
-
23
- describe ::DatabaseCleaner do
24
- before(:each) { ::DatabaseCleaner.reset }
25
-
26
- context "orm specification" do
27
- it "should not accept unrecognised orms" do
28
- expect { ::DatabaseCleaner[nil] }.to raise_error(::DatabaseCleaner::NoORMDetected)
29
- end
30
-
31
- it "should accept :active_record" do
32
- cleaner = ::DatabaseCleaner[:active_record]
33
- cleaner.should be_a(::DatabaseCleaner::Base)
34
- cleaner.orm.should eq :active_record
35
- ::DatabaseCleaner.connections.size.should eq 1
36
- end
37
-
38
- it "should accept :data_mapper" do
39
- cleaner = ::DatabaseCleaner[:data_mapper]
40
- cleaner.should be_a(::DatabaseCleaner::Base)
41
- cleaner.orm.should eq :data_mapper
42
- ::DatabaseCleaner.connections.size.should eq 1
43
- end
44
-
45
- it "should accept :mongo_mapper" do
46
- cleaner = ::DatabaseCleaner[:mongo_mapper]
47
- cleaner.should be_a(::DatabaseCleaner::Base)
48
- cleaner.orm.should eq :mongo_mapper
49
- ::DatabaseCleaner.connections.size.should eq 1
50
- end
51
-
52
- it "should accept :couch_potato" do
53
- cleaner = ::DatabaseCleaner[:couch_potato]
54
- cleaner.should be_a(::DatabaseCleaner::Base)
55
- cleaner.orm.should eq :couch_potato
56
- ::DatabaseCleaner.connections.size.should eq 1
57
- end
58
-
59
- it "should accept :moped" do
60
- cleaner = ::DatabaseCleaner[:moped]
61
- cleaner.should be_a(::DatabaseCleaner::Base)
62
- cleaner.orm.should eq :moped
63
- ::DatabaseCleaner.connections.size.should eq 1
64
- end
65
-
66
- it 'accepts :ohm' do
67
- cleaner = ::DatabaseCleaner[:ohm]
68
- cleaner.should be_a(::DatabaseCleaner::Base)
69
- cleaner.orm.should eq :ohm
70
- ::DatabaseCleaner.connections.size.should eq 1
71
- end
72
- end
73
-
74
- it "should accept multiple orm's" do
75
- ::DatabaseCleaner[:couch_potato]
76
- ::DatabaseCleaner[:data_mapper]
77
- ::DatabaseCleaner.connections.size.should eq 2
78
- ::DatabaseCleaner.connections[0].orm.should eq :couch_potato
79
- ::DatabaseCleaner.connections[1].orm.should eq :data_mapper
80
- end
81
-
82
- context "connection/db specification" do
83
- it "should accept a connection parameter and store it" do
84
- cleaner = ::DatabaseCleaner[:active_record, {:connection => :first_connection}]
85
- cleaner.should be_a(::DatabaseCleaner::Base)
86
- cleaner.orm.should eq :active_record
87
- cleaner.db.should eq :first_connection
88
- end
89
-
90
- it "should accept multiple connections for a single orm" do
91
- ::DatabaseCleaner[:data_mapper,{:connection => :first_db}]
92
- ::DatabaseCleaner[:data_mapper,{:connection => :second_db}]
93
- ::DatabaseCleaner.connections.size.should eq 2
94
- ::DatabaseCleaner.connections[0].orm.should eq :data_mapper
95
- ::DatabaseCleaner.connections[0].db.should eq :first_db
96
- ::DatabaseCleaner.connections[1].orm.should eq :data_mapper
97
- ::DatabaseCleaner.connections[1].db.should eq :second_db
98
- end
99
-
100
- it "should accept multiple connections and multiple orms" do
101
- ::DatabaseCleaner[:data_mapper, {:connection => :first_db} ]
102
- ::DatabaseCleaner[:active_record,{:connection => :second_db}]
103
- ::DatabaseCleaner[:active_record,{:connection => :first_db} ]
104
- ::DatabaseCleaner[:data_mapper, {:connection => :second_db}]
105
-
106
- ::DatabaseCleaner.connections.size.should eq 4
107
-
108
- ::DatabaseCleaner.connections[0].orm.should eq :data_mapper
109
- ::DatabaseCleaner.connections[0].db.should eq :first_db
110
-
111
- ::DatabaseCleaner.connections[1].orm.should eq :active_record
112
- ::DatabaseCleaner.connections[1].db.should eq :second_db
113
-
114
- ::DatabaseCleaner.connections[2].orm.should eq :active_record
115
- ::DatabaseCleaner.connections[2].db.should eq :first_db
116
-
117
- ::DatabaseCleaner.connections[3].orm.should eq :data_mapper
118
- ::DatabaseCleaner.connections[3].db.should eq :second_db
119
- end
120
- end
121
-
122
- context "connection/db retrieval" do
123
- it "should retrieve a db rather than create a new one" do
124
- pending
125
- connection = ::DatabaseCleaner[:active_record].strategy = :truncation
126
- ::DatabaseCleaner[:active_record].should eq connection
127
- end
128
- end
129
-
130
- context "class methods" do
131
- subject { ::DatabaseCleaner }
132
-
133
- it "should give me a default (autodetection) databasecleaner by default" do
134
- cleaner = double("cleaner").as_null_object
135
- ::DatabaseCleaner::Base.stub(:new).and_return(cleaner)
136
-
137
- ::DatabaseCleaner.connections.should eq [cleaner]
138
- end
139
- end
140
-
141
- context "single orm single connection" do
142
- let(:connection) { ::DatabaseCleaner.connections.first }
143
-
144
- it "should proxy strategy=" do
145
- stratagum = double("stratagum")
146
- connection.should_receive(:strategy=).with(stratagum)
147
- ::DatabaseCleaner.strategy = stratagum
148
- end
149
-
150
- it "should proxy orm=" do
151
- orm = double("orm")
152
- connection.should_receive(:orm=).with(orm)
153
- ::DatabaseCleaner.orm = orm
154
- end
155
-
156
- it "should proxy start" do
157
- connection.should_receive(:start)
158
- ::DatabaseCleaner.start
159
- end
160
-
161
- it "should proxy clean" do
162
- connection.should_receive(:clean)
163
- ::DatabaseCleaner.clean
164
- end
165
-
166
- it 'should proxy cleaning' do
167
- connection.should_receive(:cleaning)
168
- ::DatabaseCleaner.cleaning { }
169
- end
170
-
171
- it "should proxy clean_with" do
172
- stratagem = double("stratgem")
173
- connection.should_receive(:clean_with).with(stratagem, {})
174
- ::DatabaseCleaner.clean_with stratagem, {}
175
- end
176
- end
177
-
178
- context "multiple connections" do
179
-
180
- #these are relativly simple, all we need to do is make sure all connections are cleaned/started/cleaned_with appropriatly.
181
- context "simple proxy methods" do
182
-
183
- let(:active_record) { double("active_mock") }
184
- let(:data_mapper) { double("data_mock") }
185
-
186
- before(:each) do
187
- ::DatabaseCleaner.stub(:connections).and_return([active_record,data_mapper])
188
- end
189
-
190
- it "should proxy orm to all connections" do
191
- active_record.should_receive(:orm=)
192
- data_mapper.should_receive(:orm=)
193
-
194
- ::DatabaseCleaner.orm = double("orm")
195
- end
196
-
197
- it "should proxy start to all connections" do
198
- active_record.should_receive(:start)
199
- data_mapper.should_receive(:start)
200
-
201
- ::DatabaseCleaner.start
202
- end
203
-
204
- it "should proxy clean to all connections" do
205
- active_record.should_receive(:clean)
206
- data_mapper.should_receive(:clean)
207
-
208
- ::DatabaseCleaner.clean
209
- end
210
-
211
- it "should initiate cleaning on each connection, yield, and finish cleaning each connection" do
212
- [active_record, data_mapper].each do |connection|
213
- mc = class << connection; self; end
214
- mc.send(:attr_reader, :started, :cleaned)
215
- mc.send(:define_method, 'cleaning') do |&block|
216
- @started = true
217
- block.call
218
- @cleaned = true
219
- end
220
- end
221
-
222
- ::DatabaseCleaner.cleaning do
223
- active_record.started.should == true
224
- data_mapper.started.should == true
225
- active_record.cleaned.should == nil
226
- data_mapper.cleaned.should == nil
227
- @yielded = true
228
- end
229
- active_record.cleaned.should == true
230
- data_mapper.cleaned.should == true
231
- end
232
-
233
- it "should proxy clean_with to all connections" do
234
- stratagem = double("stratgem")
235
- active_record.should_receive(:clean_with).with(stratagem)
236
- data_mapper.should_receive(:clean_with).with(stratagem)
237
-
238
- ::DatabaseCleaner.clean_with stratagem
239
- end
240
- end
241
-
242
- # ah now we have some difficulty, we mustn't allow duplicate connections to exist, but they could
243
- # plausably want to force orm/strategy change on two sets of orm that differ only on db
244
- context "multiple orm proxy methods" do
245
-
246
- pending "should proxy orm to all connections and remove duplicate connections" do
247
- active_record_1 = double("active_mock_on_db_one").as_null_object
248
- active_record_2 = double("active_mock_on_db_two").as_null_object
249
- data_mapper_1 = double("data_mock_on_db_one").as_null_object
250
-
251
- ::DatabaseCleaner.connections_stub [active_record_1,active_record_2,data_mapper_1]
252
-
253
- active_record_1.should_receive(:orm=).with(:data_mapper)
254
- active_record_2.should_receive(:orm=).with(:data_mapper)
255
- data_mapper_1.should_receive(:orm=).with(:data_mapper)
256
-
257
- active_record_1.should_receive(:==).with(data_mapper_1).and_return(true)
258
-
259
- ::DatabaseCleaner.connections.size.should eq 3
260
- ::DatabaseCleaner.orm = :data_mapper
261
- ::DatabaseCleaner.connections.size.should eq 2
262
- end
263
-
264
- it "should proxy strategy to all connections and remove duplicate connections" do
265
- active_record_1 = double("active_mock_strategy_one").as_null_object
266
- active_record_2 = double("active_mock_strategy_two").as_null_object
267
- strategy = double("strategy")
268
-
269
- ::DatabaseCleaner.connections_stub [active_record_1,active_record_2]
270
-
271
- active_record_1.should_receive(:strategy=).with(strategy)
272
- active_record_2.should_receive(:strategy=).with(strategy)
273
-
274
- active_record_1.should_receive(:==).with(active_record_2).and_return(true)
275
-
276
- ::DatabaseCleaner.connections.size.should eq 2
277
- ::DatabaseCleaner.strategy = strategy
278
- ::DatabaseCleaner.connections.size.should eq 1
279
- end
280
- end
281
- end
282
-
283
- describe "remove_duplicates" do
284
- it "should remove duplicates if they are identical" do
285
- orm = double("orm")
286
- connection = double("a datamapper connection", :orm => orm )
287
-
288
- ::DatabaseCleaner.connections_stub [connection,connection,connection]
289
-
290
- ::DatabaseCleaner.remove_duplicates
291
- ::DatabaseCleaner.connections.size.should eq 1
292
- end
293
- end
294
-
295
- describe "app_root" do
296
- it "should default to Dir.pwd" do
297
- DatabaseCleaner.app_root.should eq Dir.pwd
298
- end
299
-
300
- it "should store specific paths" do
301
- DatabaseCleaner.app_root = '/path/to'
302
- DatabaseCleaner.app_root.should eq '/path/to'
303
- end
304
- end
305
-
306
- describe "orm_module" do
307
- subject { ::DatabaseCleaner }
308
-
309
- it "should return DatabaseCleaner::ActiveRecord for :active_record" do
310
- ::DatabaseCleaner::ActiveRecord = double("ar module") unless defined? ::DatabaseCleaner::ActiveRecord
311
- subject.orm_module(:active_record).should eq DatabaseCleaner::ActiveRecord
312
- end
313
-
314
- it "should return DatabaseCleaner::DataMapper for :data_mapper" do
315
- ::DatabaseCleaner::DataMapper = double("dm module") unless defined? ::DatabaseCleaner::DataMapper
316
- subject.orm_module(:data_mapper).should eq DatabaseCleaner::DataMapper
317
- end
318
-
319
- it "should return DatabaseCleaner::MongoMapper for :mongo_mapper" do
320
- ::DatabaseCleaner::MongoMapper = double("mm module") unless defined? ::DatabaseCleaner::MongoMapper
321
- subject.orm_module(:mongo_mapper).should eq DatabaseCleaner::MongoMapper
322
- end
323
-
324
- it "should return DatabaseCleaner::Mongoid for :mongoid" do
325
- ::DatabaseCleaner::Mongoid = double("mongoid module") unless defined? ::DatabaseCleaner::Mongoid
326
- subject.orm_module(:mongoid).should eq DatabaseCleaner::Mongoid
327
- end
328
-
329
- it "should return DatabaseCleaner::Mongo for :mongo" do
330
- ::DatabaseCleaner::Mongo = double("mongo module") unless defined? ::DatabaseCleaner::Mongo
331
- subject.orm_module(:mongo).should eq DatabaseCleaner::Mongo
332
- end
333
-
334
- it "should return DatabaseCleaner::CouchPotato for :couch_potato" do
335
- ::DatabaseCleaner::CouchPotato = double("cp module") unless defined? ::DatabaseCleaner::CouchPotato
336
- subject.orm_module(:couch_potato).should eq DatabaseCleaner::CouchPotato
337
- end
338
-
339
- it "should return DatabaseCleaner::Neo4j for :neo4j" do
340
- ::DatabaseCleaner::Neo4j = double("nj module") unless defined? ::DatabaseCleaner::Neo4j
341
- subject.orm_module(:neo4j).should eq DatabaseCleaner::Neo4j
342
- end
343
-
344
- end
345
- end
@@ -1,41 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
- require 'database_cleaner/couch_potato/truncation'
3
- require 'couch_potato'
4
-
5
- module DatabaseCleaner
6
- module CouchPotato
7
-
8
- describe Truncation do
9
- let(:database) { double('database') }
10
-
11
- before(:each) do
12
- ::CouchPotato.stub(:couchrest_database).and_return(database)
13
- end
14
-
15
- it "should re-create the database" do
16
- database.should_receive(:recreate!)
17
-
18
- Truncation.new.clean
19
- end
20
-
21
- it "should raise an error when the :only option is used" do
22
- running {
23
- Truncation.new(:only => ['document-type'])
24
- }.should raise_error(ArgumentError)
25
- end
26
-
27
- it "should raise an error when the :except option is used" do
28
- running {
29
- Truncation.new(:except => ['document-type'])
30
- }.should raise_error(ArgumentError)
31
- end
32
-
33
- it "should raise an error when invalid options are provided" do
34
- running {
35
- Truncation.new(:foo => 'bar')
36
- }.should raise_error(ArgumentError)
37
- end
38
- end
39
-
40
- end
41
- end
@@ -1,30 +0,0 @@
1
- require 'spec_helper'
2
- require 'database_cleaner/data_mapper/base'
3
- require 'database_cleaner/shared_strategy'
4
-
5
- module DatabaseCleaner
6
- describe DataMapper do
7
- it { should respond_to(:available_strategies) }
8
- end
9
-
10
- module DataMapper
11
- class ExampleStrategy
12
- include ::DatabaseCleaner::DataMapper::Base
13
- end
14
-
15
- describe ExampleStrategy do
16
- it_should_behave_like "a generic strategy"
17
- it { should respond_to(:db) }
18
- it { should respond_to(:db=) }
19
-
20
- it "should store my desired db" do
21
- subject.db = :my_db
22
- subject.db.should eq :my_db
23
- end
24
-
25
- it "should default to :default" do
26
- subject.db.should eq :default
27
- end
28
- end
29
- end
30
- end
@@ -1,23 +0,0 @@
1
- require File.dirname(__FILE__) + '/../../spec_helper'
2
- require 'database_cleaner/data_mapper/transaction'
3
- require 'database_cleaner/shared_strategy'
4
- #require 'data_mapper'
5
-
6
- module DatabaseCleaner
7
- module DataMapper
8
-
9
- describe Transaction do
10
- it_should_behave_like "a generic strategy"
11
- it_should_behave_like "a generic transaction strategy"
12
-
13
- describe "start" do
14
- it "should start a transaction"
15
- end
16
-
17
- describe "clean" do
18
- it "should finish a transaction"
19
- end
20
- end
21
-
22
- end
23
- end
@@ -1,41 +0,0 @@
1
- require 'spec_helper'
2
- require 'dm-core'
3
- require 'dm-sqlite-adapter'
4
- require File.expand_path('../../../../support/data_mapper/sqlite3_setup', __FILE__)
5
- require 'database_cleaner/data_mapper/truncation'
6
-
7
- module DataMapper
8
- module ConnectionAdapters
9
- describe do
10
- before(:all) { data_mapper_sqlite3_setup }
11
-
12
- let(:adapter) { DataMapperSQLite3Adapter }
13
-
14
- let(:connection) do
15
- data_mapper_sqlite3_connection
16
- end
17
-
18
- before(:each) do
19
- connection.truncate_tables(DataMapper::Model.descendants.map { |d| d.storage_names[:default] || d.name.underscore })
20
- end
21
-
22
- describe "#truncate_table" do
23
- it "truncates the table" do
24
- 2.times { DmUser.create }
25
-
26
- connection.truncate_table(DmUser.storage_names[:default])
27
- DmUser.count.should eq 0
28
- end
29
-
30
- it "resets AUTO_INCREMENT index of table" do
31
- 2.times { DmUser.create }
32
- DmUser.destroy
33
-
34
- connection.truncate_table(DmUser.storage_names[:default])
35
-
36
- DmUser.create.id.should eq 1
37
- end
38
- end
39
- end
40
- end
41
- end