database_cleaner 0.5.2 → 0.6.0.rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +145 -0
- data/History.txt +24 -1
- data/README.textile +48 -0
- data/Rakefile +4 -0
- data/TODO +3 -0
- data/VERSION.yml +3 -2
- data/examples/Gemfile +46 -0
- data/examples/Gemfile.lock +145 -0
- data/examples/config/database.yml +7 -0
- data/examples/config/database.yml.example +8 -0
- data/examples/db/activerecord_one.db +0 -0
- data/examples/db/activerecord_two.db +0 -0
- data/examples/db/datamapper_default.db +0 -0
- data/examples/db/datamapper_one.db +0 -0
- data/examples/db/datamapper_two.db +0 -0
- data/examples/db/sqlite_databases_go_here +0 -0
- data/examples/features/example_multiple_db.feature +23 -0
- data/examples/features/example_multiple_orm.feature +22 -0
- data/examples/features/step_definitions/activerecord_steps.rb +31 -0
- data/examples/features/step_definitions/couchpotato_steps.rb +31 -0
- data/examples/features/step_definitions/datamapper_steps.rb +37 -0
- data/examples/features/step_definitions/mongoid_steps.rb +23 -0
- data/examples/features/step_definitions/mongomapper_steps.rb +31 -0
- data/examples/features/step_definitions/translation_steps.rb +55 -0
- data/examples/features/support/env.rb +49 -10
- data/examples/lib/activerecord_models.rb +34 -5
- data/examples/lib/couchpotato_models.rb +46 -6
- data/examples/lib/datamapper_models.rb +37 -3
- data/examples/lib/mongoid_models.rb +28 -2
- data/examples/lib/mongomapper_models.rb +35 -1
- data/features/cleaning_multiple_dbs.feature +20 -0
- data/features/cleaning_multiple_orms.feature +29 -0
- data/features/step_definitions/database_cleaner_steps.rb +20 -13
- data/features/support/feature_runner.rb +39 -0
- data/lib/database_cleaner/active_record/base.rb +46 -0
- data/lib/database_cleaner/active_record/transaction.rb +10 -10
- data/lib/database_cleaner/active_record/truncation.rb +17 -7
- data/lib/database_cleaner/base.rb +129 -0
- data/lib/database_cleaner/configuration.rb +45 -97
- data/lib/database_cleaner/couch_potato/base.rb +7 -0
- data/lib/database_cleaner/couch_potato/truncation.rb +4 -2
- data/lib/database_cleaner/cucumber.rb +0 -1
- data/lib/database_cleaner/data_mapper/base.rb +21 -0
- data/lib/database_cleaner/data_mapper/transaction.rb +10 -5
- data/lib/database_cleaner/data_mapper/truncation.rb +52 -19
- data/lib/database_cleaner/generic/base.rb +23 -0
- data/lib/database_cleaner/generic/truncation.rb +43 -0
- data/lib/database_cleaner/mongo_mapper/base.rb +20 -0
- data/lib/database_cleaner/mongo_mapper/truncation.rb +9 -3
- data/lib/database_cleaner/mongoid/base.rb +20 -0
- data/lib/database_cleaner/mongoid/truncation.rb +9 -5
- data/spec/database_cleaner/active_record/base_spec.rb +130 -0
- data/spec/database_cleaner/active_record/truncation_spec.rb +19 -18
- data/spec/database_cleaner/base_spec.rb +441 -0
- data/spec/database_cleaner/configuration_spec.rb +255 -68
- data/spec/database_cleaner/couch_potato/truncation_spec.rb +4 -3
- data/spec/database_cleaner/data_mapper/base_spec.rb +30 -0
- data/spec/database_cleaner/data_mapper/transaction_spec.rb +23 -0
- data/spec/database_cleaner/data_mapper/truncation_spec.rb +11 -0
- data/spec/database_cleaner/generic/base_spec.rb +22 -0
- data/spec/database_cleaner/generic/truncation_spec.rb +68 -0
- data/spec/database_cleaner/mongo_mapper/base_spec.rb +33 -0
- data/spec/database_cleaner/mongo_mapper/mongo_examples.rb +8 -0
- data/spec/database_cleaner/mongo_mapper/truncation_spec.rb +11 -18
- data/spec/database_cleaner/shared_strategy_spec.rb +13 -0
- data/spec/rcov.opts +1 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +10 -3
- metadata +76 -8
- data/examples/features/step_definitions/example_steps.rb +0 -8
- data/lib/database_cleaner/truncation_base.rb +0 -41
@@ -1,107 +1,294 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
require 'database_cleaner/active_record/transaction'
|
3
|
-
require 'database_cleaner/data_mapper/transaction'
|
4
2
|
|
3
|
+
module DatabaseCleaner
|
4
|
+
class << self
|
5
|
+
def reset
|
6
|
+
@connections = nil
|
7
|
+
end
|
8
|
+
|
9
|
+
def connections_stub!(array)
|
10
|
+
@connections = array
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe ::DatabaseCleaner do
|
16
|
+
before(:each) { ::DatabaseCleaner.reset }
|
17
|
+
|
18
|
+
context "orm specification" do
|
19
|
+
it "should not accept unrecognised orms" do
|
20
|
+
expect { ::DatabaseCleaner[nil] }.should raise_error(::DatabaseCleaner::NoORMDetected)
|
21
|
+
end
|
5
22
|
|
6
|
-
|
23
|
+
it "should accept :active_record" do
|
24
|
+
cleaner = ::DatabaseCleaner[:active_record]
|
25
|
+
cleaner.should be_a(::DatabaseCleaner::Base)
|
26
|
+
cleaner.orm.should == :active_record
|
27
|
+
::DatabaseCleaner.connections.size.should == 1
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should accept :data_mapper" do
|
31
|
+
cleaner = ::DatabaseCleaner[:data_mapper]
|
32
|
+
cleaner.should be_a(::DatabaseCleaner::Base)
|
33
|
+
cleaner.orm.should == :data_mapper
|
34
|
+
::DatabaseCleaner.connections.size.should == 1
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should accept :mongo_mapper" do
|
38
|
+
cleaner = ::DatabaseCleaner[:mongo_mapper]
|
39
|
+
cleaner.should be_a(::DatabaseCleaner::Base)
|
40
|
+
cleaner.orm.should == :mongo_mapper
|
41
|
+
::DatabaseCleaner.connections.size.should == 1
|
42
|
+
end
|
7
43
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Object.send(:remove_const, 'Mongoid') if defined?(::Mongoid)
|
15
|
-
# need to add one for each ORM that we load in the spec helper...
|
44
|
+
it "should accept :couch_potato" do
|
45
|
+
cleaner = ::DatabaseCleaner[:couch_potato]
|
46
|
+
cleaner.should be_a(::DatabaseCleaner::Base)
|
47
|
+
cleaner.orm.should == :couch_potato
|
48
|
+
::DatabaseCleaner.connections.size.should == 1
|
49
|
+
end
|
16
50
|
end
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
51
|
+
|
52
|
+
it "should accept multiple orm's" do
|
53
|
+
::DatabaseCleaner[:couch_potato]
|
54
|
+
::DatabaseCleaner[:data_mapper]
|
55
|
+
::DatabaseCleaner.connections.size.should == 2
|
56
|
+
::DatabaseCleaner.connections[0].orm.should == :couch_potato
|
57
|
+
::DatabaseCleaner.connections[1].orm.should == :data_mapper
|
22
58
|
end
|
23
59
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
60
|
+
context "connection/db specification" do
|
61
|
+
it "should accept a connection parameter and store it" do
|
62
|
+
cleaner = ::DatabaseCleaner[:active_record, {:connection => :first_connection}]
|
63
|
+
cleaner.should be_a(::DatabaseCleaner::Base)
|
64
|
+
cleaner.orm.should == :active_record
|
65
|
+
cleaner.db.should == :first_connection
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should accept multiple connections for a single orm" do
|
69
|
+
::DatabaseCleaner[:data_mapper,{:connection => :first_db}]
|
70
|
+
::DatabaseCleaner[:data_mapper,{:connection => :second_db}]
|
71
|
+
::DatabaseCleaner.connections.size.should == 2
|
72
|
+
::DatabaseCleaner.connections[0].orm.should == :data_mapper
|
73
|
+
::DatabaseCleaner.connections[0].db.should == :first_db
|
74
|
+
::DatabaseCleaner.connections[1].orm.should == :data_mapper
|
75
|
+
::DatabaseCleaner.connections[1].db.should == :second_db
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should accept multiple connections and multiple orms" do
|
79
|
+
::DatabaseCleaner[:data_mapper, {:connection => :first_db} ]
|
80
|
+
::DatabaseCleaner[:active_record,{:connection => :second_db}]
|
81
|
+
::DatabaseCleaner[:active_record,{:connection => :first_db} ]
|
82
|
+
::DatabaseCleaner[:data_mapper, {:connection => :second_db}]
|
83
|
+
|
84
|
+
::DatabaseCleaner.connections.size.should == 4
|
85
|
+
|
86
|
+
::DatabaseCleaner.connections[0].orm.should == :data_mapper
|
87
|
+
::DatabaseCleaner.connections[0].db.should == :first_db
|
88
|
+
|
89
|
+
::DatabaseCleaner.connections[1].orm.should == :active_record
|
90
|
+
::DatabaseCleaner.connections[1].db.should == :second_db
|
30
91
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
92
|
+
::DatabaseCleaner.connections[2].orm.should == :active_record
|
93
|
+
::DatabaseCleaner.connections[2].db.should == :first_db
|
94
|
+
|
95
|
+
::DatabaseCleaner.connections[3].orm.should == :data_mapper
|
96
|
+
::DatabaseCleaner.connections[3].db.should == :second_db
|
36
97
|
end
|
37
98
|
end
|
38
99
|
|
39
|
-
|
40
|
-
it "should
|
41
|
-
|
42
|
-
|
43
|
-
DatabaseCleaner.
|
100
|
+
context "connection/db retrieval" do
|
101
|
+
it "should retrieve a db rather than create a new one" do
|
102
|
+
pending
|
103
|
+
connection = ::DatabaseCleaner[:active_record].strategy = :truncation
|
104
|
+
::DatabaseCleaner[:active_record].should == connection
|
44
105
|
end
|
45
106
|
end
|
46
107
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
108
|
+
context "class methods" do
|
109
|
+
subject { ::DatabaseCleaner }
|
110
|
+
|
111
|
+
its(:connections) { should respond_to(:each) }
|
51
112
|
|
52
|
-
|
53
|
-
|
54
|
-
DatabaseCleaner.
|
113
|
+
it "should give me a default (autodetection) databasecleaner by default" do
|
114
|
+
cleaner = mock("cleaner").as_null_object
|
115
|
+
::DatabaseCleaner::Base.should_receive(:new).with().and_return(cleaner)
|
55
116
|
|
56
|
-
DatabaseCleaner
|
57
|
-
DatabaseCleaner.
|
117
|
+
::DatabaseCleaner.connections.should have(1).items
|
118
|
+
::DatabaseCleaner.connections.first.should == cleaner
|
58
119
|
end
|
120
|
+
end
|
59
121
|
|
60
|
-
|
61
|
-
|
62
|
-
Object.send(:remove_const, 'DataMapper') if defined?(::DataMapper)
|
63
|
-
Object.send(:remove_const, 'CouchPotato') if defined?(::CouchPotato)
|
122
|
+
context "single orm single connection" do
|
123
|
+
let(:connection) { ::DatabaseCleaner.connections.first }
|
64
124
|
|
65
|
-
|
125
|
+
it "should proxy strategy=" do
|
126
|
+
stratagum = mock("stratagum")
|
127
|
+
connection.should_receive(:strategy=).with(stratagum)
|
128
|
+
::DatabaseCleaner.strategy = stratagum
|
66
129
|
end
|
67
130
|
|
68
|
-
it "should
|
69
|
-
|
70
|
-
|
131
|
+
it "should proxy orm=" do
|
132
|
+
orm = mock("orm")
|
133
|
+
connection.should_receive(:orm=).with(orm)
|
134
|
+
::DatabaseCleaner.orm = orm
|
135
|
+
end
|
71
136
|
|
72
|
-
|
137
|
+
it "should proxy start" do
|
138
|
+
connection.should_receive(:start)
|
139
|
+
::DatabaseCleaner.start
|
73
140
|
end
|
74
141
|
|
75
|
-
it "should
|
76
|
-
|
142
|
+
it "should proxy clean" do
|
143
|
+
connection.should_receive(:clean)
|
144
|
+
::DatabaseCleaner.clean
|
77
145
|
end
|
78
146
|
|
79
|
-
it "should
|
80
|
-
|
147
|
+
it "should proxy clean_with" do
|
148
|
+
stratagem = mock("stratgem")
|
149
|
+
connection.should_receive(:clean_with).with(stratagem)
|
150
|
+
::DatabaseCleaner.clean_with stratagem
|
81
151
|
end
|
152
|
+
end
|
153
|
+
|
154
|
+
context "multiple connections" do
|
155
|
+
|
156
|
+
#these are relativly simple, all we need to do is make sure all connections are cleaned/started/cleaned_with appropriatly.
|
157
|
+
context "simple proxy methods" do
|
158
|
+
|
159
|
+
let(:active_record) { mock("active_mock") }
|
160
|
+
let(:data_mapper) { mock("data_mock") }
|
161
|
+
|
162
|
+
before(:each) do
|
163
|
+
::DatabaseCleaner.stub!(:connections).and_return([active_record,data_mapper])
|
164
|
+
end
|
165
|
+
|
166
|
+
it "should proxy orm to all connections" do
|
167
|
+
active_record.should_receive(:orm=)
|
168
|
+
data_mapper.should_receive(:orm=)
|
169
|
+
|
170
|
+
::DatabaseCleaner.orm = mock("orm")
|
171
|
+
end
|
172
|
+
|
173
|
+
it "should proxy start to all connections" do
|
174
|
+
active_record.should_receive(:start)
|
175
|
+
data_mapper.should_receive(:start)
|
176
|
+
|
177
|
+
::DatabaseCleaner.start
|
178
|
+
end
|
179
|
+
|
180
|
+
it "should proxy clean to all connections" do
|
181
|
+
active_record.should_receive(:clean)
|
182
|
+
data_mapper.should_receive(:clean)
|
183
|
+
|
184
|
+
::DatabaseCleaner.clean
|
185
|
+
end
|
186
|
+
|
187
|
+
it "should proxy clean_with to all connections" do
|
188
|
+
stratagem = mock("stratgem")
|
189
|
+
active_record.should_receive(:clean_with).with(stratagem)
|
190
|
+
data_mapper.should_receive(:clean_with).with(stratagem)
|
82
191
|
|
83
|
-
|
84
|
-
|
85
|
-
running { DatabaseCleaner.strategy = mock_strategy }.should_not raise_error
|
192
|
+
::DatabaseCleaner.clean_with stratagem
|
193
|
+
end
|
86
194
|
end
|
87
195
|
|
88
|
-
|
196
|
+
# ah now we have some difficulty, we mustn't allow duplicate connections to exist, but they could
|
197
|
+
# plausably want to force orm/strategy change on two sets of orm that differ only on db
|
198
|
+
context "multiple orm proxy methods" do
|
199
|
+
|
200
|
+
it "should proxy orm to all connections and remove duplicate connections" do
|
201
|
+
active_record_1 = mock("active_mock_on_db_one").as_null_object
|
202
|
+
active_record_2 = mock("active_mock_on_db_two").as_null_object
|
203
|
+
data_mapper_1 = mock("data_mock_on_db_one").as_null_object
|
204
|
+
|
205
|
+
::DatabaseCleaner.connections_stub! [active_record_1,active_record_2,data_mapper_1]
|
206
|
+
|
207
|
+
active_record_1.should_receive(:orm=).with(:data_mapper)
|
208
|
+
active_record_2.should_receive(:orm=).with(:data_mapper)
|
209
|
+
data_mapper_1.should_receive(:orm=).with(:data_mapper)
|
210
|
+
|
211
|
+
active_record_1.should_receive(:==).with(data_mapper_1).and_return(true)
|
212
|
+
|
213
|
+
::DatabaseCleaner.connections.size.should == 3
|
214
|
+
::DatabaseCleaner.orm = :data_mapper
|
215
|
+
::DatabaseCleaner.connections.size.should == 2
|
216
|
+
end
|
89
217
|
|
218
|
+
it "should proxy strategy to all connections and remove duplicate connections" do
|
219
|
+
active_record_1 = mock("active_mock_strategy_one").as_null_object
|
220
|
+
active_record_2 = mock("active_mock_strategy_two").as_null_object
|
221
|
+
strategy = mock("strategy")
|
90
222
|
|
91
|
-
|
92
|
-
describe ".#{strategy_method}" do
|
93
|
-
it "should be delgated to the strategy set with strategy=" do
|
94
|
-
DatabaseCleaner.strategy = :transaction
|
223
|
+
::DatabaseCleaner.connections_stub! [active_record_1,active_record_2]
|
95
224
|
|
96
|
-
|
225
|
+
active_record_1.should_receive(:strategy=).with(strategy)
|
226
|
+
active_record_2.should_receive(:strategy=).with(strategy)
|
97
227
|
|
98
|
-
|
99
|
-
end
|
228
|
+
active_record_1.should_receive(:==).with(active_record_2).and_return(true)
|
100
229
|
|
101
|
-
|
102
|
-
|
103
|
-
|
230
|
+
::DatabaseCleaner.connections.size.should == 2
|
231
|
+
::DatabaseCleaner.strategy = strategy
|
232
|
+
::DatabaseCleaner.connections.size.should == 1
|
104
233
|
end
|
105
234
|
end
|
235
|
+
end
|
236
|
+
|
237
|
+
describe "remove_duplicates" do
|
238
|
+
it "should remove duplicates if they are identical" do
|
239
|
+
orm = mock("orm")
|
240
|
+
connection = mock("a datamapper connection", :orm => orm )
|
241
|
+
|
242
|
+
::DatabaseCleaner.connections_stub! [connection,connection,connection]
|
243
|
+
|
244
|
+
::DatabaseCleaner.remove_duplicates
|
245
|
+
::DatabaseCleaner.connections.size.should == 1
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
describe "app_root" do
|
250
|
+
it "should default to Dir.pwd" do
|
251
|
+
DatabaseCleaner.app_root.should == Dir.pwd
|
252
|
+
end
|
106
253
|
|
254
|
+
it "should store specific paths" do
|
255
|
+
DatabaseCleaner.app_root = '/path/to'
|
256
|
+
DatabaseCleaner.app_root.should == '/path/to'
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
describe "orm_module" do
|
261
|
+
subject { ::DatabaseCleaner }
|
262
|
+
|
263
|
+
it "should return DatabaseCleaner::ActiveRecord for :active_record" do
|
264
|
+
::DatabaseCleaner::ActiveRecord = mock("ar module") unless defined? ::DatabaseCleaner::ActiveRecord
|
265
|
+
subject.orm_module(:active_record).should == DatabaseCleaner::ActiveRecord
|
266
|
+
end
|
267
|
+
|
268
|
+
it "should return DatabaseCleaner::DataMapper for :data_mapper" do
|
269
|
+
::DatabaseCleaner::DataMapper = mock("dm module") unless defined? ::DatabaseCleaner::DataMapper
|
270
|
+
subject.orm_module(:data_mapper).should == DatabaseCleaner::DataMapper
|
271
|
+
end
|
272
|
+
|
273
|
+
it "should return DatabaseCleaner::MongoMapper for :mongo_mapper" do
|
274
|
+
::DatabaseCleaner::MongoMapper = mock("mm module") unless defined? ::DatabaseCleaner::MongoMapper
|
275
|
+
subject.orm_module(:mongo_mapper).should == DatabaseCleaner::MongoMapper
|
276
|
+
end
|
277
|
+
|
278
|
+
it "should return DatabaseCleaner::Mongoid for :mongoid" do
|
279
|
+
::DatabaseCleaner::Mongoid = mock("mongoid module") unless defined? ::DatabaseCleaner::Mongoid
|
280
|
+
subject.orm_module(:mongoid).should == DatabaseCleaner::Mongoid
|
281
|
+
end
|
282
|
+
|
283
|
+
it "should return DatabaseCleaner::Mongo for :mongo" do
|
284
|
+
::DatabaseCleaner::Mongo = mock("mongo module") unless defined? ::DatabaseCleaner::Mongo
|
285
|
+
subject.orm_module(:mongo).should == DatabaseCleaner::Mongo
|
286
|
+
end
|
287
|
+
|
288
|
+
it "should return DatabaseCleaner::CouchPotato for :couch_potato" do
|
289
|
+
::DatabaseCleaner::CouchPotato = mock("cp module") unless defined? ::DatabaseCleaner::CouchPotato
|
290
|
+
subject.orm_module(:couch_potato).should == DatabaseCleaner::CouchPotato
|
291
|
+
end
|
292
|
+
|
293
|
+
end
|
107
294
|
end
|
@@ -6,13 +6,14 @@ module DatabaseCleaner
|
|
6
6
|
module CouchPotato
|
7
7
|
|
8
8
|
describe Truncation do
|
9
|
+
let(:database) { mock('database') }
|
10
|
+
|
9
11
|
before(:each) do
|
10
|
-
|
11
|
-
::CouchPotato.stub!(:couchrest_database).and_return(@database)
|
12
|
+
::CouchPotato.stub!(:couchrest_database).and_return(database)
|
12
13
|
end
|
13
14
|
|
14
15
|
it "should re-create the database" do
|
15
|
-
|
16
|
+
database.should_receive(:recreate!)
|
16
17
|
|
17
18
|
Truncation.new.clean
|
18
19
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'database_cleaner/data_mapper/base'
|
3
|
+
require 'database_cleaner/shared_strategy_spec'
|
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 == :my_db
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should default to :default" do
|
26
|
+
subject.db.should == :default
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
require 'database_cleaner/data_mapper/transaction'
|
3
|
+
require 'database_cleaner/shared_strategy_spec'
|
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
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'database_cleaner/data_mapper/truncation'
|
2
|
+
require 'database_cleaner/shared_strategy_spec'
|
3
|
+
|
4
|
+
module DatabaseCleaner
|
5
|
+
module DataMapper
|
6
|
+
describe Truncation do
|
7
|
+
it_should_behave_like "a generic strategy"
|
8
|
+
it_should_behave_like "a generic truncation strategy"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|