database_cleaner 0.6.0.rc.1 → 0.6.0.rc.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -73,10 +73,13 @@ GEM
73
73
  durran-validatable (2.0.1)
74
74
  extlib (0.9.15)
75
75
  fastercsv (1.5.3)
76
+ ffi (0.6.3)
77
+ rake (>= 0.8.7)
76
78
  gemcutter (0.6.1)
77
79
  gherkin (2.1.5)
78
80
  trollop (~> 1.16.2)
79
81
  git (1.2.5)
82
+ growl (1.0.3)
80
83
  jeweler (1.4.0)
81
84
  gemcutter (>= 0.1.0)
82
85
  git (>= 1.2.5)
@@ -85,6 +88,8 @@ GEM
85
88
  activesupport (>= 2.3.4)
86
89
  json (1.4.6)
87
90
  json_pure (1.4.6)
91
+ libnotify (0.2.0)
92
+ ffi (>= 0.6.2)
88
93
  linecache (0.43)
89
94
  mime-types (1.16)
90
95
  mongo (1.0.7)
@@ -102,9 +107,18 @@ GEM
102
107
  plucky (0.3.4)
103
108
  mongo (~> 1.0.7)
104
109
  rake (0.8.7)
110
+ rb-inotify (0.8.1)
111
+ ffi (>= 0.5.0)
105
112
  rcov (0.9.8)
106
113
  rest-client (1.6.0)
107
114
  mime-types (>= 1.16)
115
+ rspactor (0.7.0.beta.6)
116
+ bundler (>= 1.0.0.rc.5)
117
+ growl (>= 1.0.3)
118
+ libnotify (>= 0.1.3)
119
+ rb-inotify
120
+ sys-uname (>= 0.8.4)
121
+ trollop (>= 1.16.2)
108
122
  rspec (1.3.0)
109
123
  ruby-debug (0.10.3)
110
124
  columnize (>= 0.1)
@@ -115,6 +129,7 @@ GEM
115
129
  json_pure (>= 1.1.7)
116
130
  sqlite3-ruby (1.3.1)
117
131
  stringex (1.1.0)
132
+ sys-uname (0.8.4)
118
133
  term-ansicolor (1.0.5)
119
134
  trollop (1.16.2)
120
135
  tzinfo (0.3.22)
@@ -139,6 +154,7 @@ DEPENDENCIES
139
154
  mongoid (= 1.9.1)
140
155
  rake
141
156
  rcov
157
+ rspactor
142
158
  rspec
143
159
  ruby-debug
144
160
  sqlite3-ruby
data/examples/Gemfile CHANGED
@@ -2,12 +2,12 @@ source "http://rubygems.org"
2
2
  # group :development do
3
3
  # # gem "mysql"
4
4
  # # gem "json_pure", "1.4.3"
5
- #
6
- #
5
+ #
6
+ #
7
7
  # # gem "datamapper", "1.0.0"
8
8
  # # gem "dm-migrations", "1.0.0"
9
9
  # # gem "dm-sqlite-adapter", "1.0.0"
10
- #
10
+ #
11
11
  # # mongo requirements
12
12
  # # gem "mongo", "1.0.1"
13
13
  # # gem "mongo_ext", "0.19.3"
@@ -17,12 +17,12 @@ source "http://rubygems.org"
17
17
  group :development do
18
18
  gem "rake"
19
19
  gem "ruby-debug"
20
-
20
+
21
21
  gem "bundler"
22
22
  gem "jeweler"
23
-
23
+
24
24
  gem "json_pure"
25
-
25
+
26
26
  #ORM's
27
27
  gem "activerecord", "2.3.8"
28
28
  gem "datamapper", "1.0.0"
@@ -36,6 +36,7 @@ end
36
36
 
37
37
  group :test do
38
38
  gem "rspec"
39
+ gem "rspactor"
39
40
  gem "rcov"
40
41
  gem "ZenTest"
41
42
  end
@@ -43,4 +44,4 @@ end
43
44
  group :cucumber do
44
45
  gem "cucumber"
45
46
  gem 'sqlite3-ruby'
46
- end
47
+ end
@@ -73,10 +73,13 @@ GEM
73
73
  durran-validatable (2.0.1)
74
74
  extlib (0.9.15)
75
75
  fastercsv (1.5.3)
76
+ ffi (0.6.3)
77
+ rake (>= 0.8.7)
76
78
  gemcutter (0.6.1)
77
79
  gherkin (2.1.5)
78
80
  trollop (~> 1.16.2)
79
81
  git (1.2.5)
82
+ growl (1.0.3)
80
83
  jeweler (1.4.0)
81
84
  gemcutter (>= 0.1.0)
82
85
  git (>= 1.2.5)
@@ -85,6 +88,8 @@ GEM
85
88
  activesupport (>= 2.3.4)
86
89
  json (1.4.6)
87
90
  json_pure (1.4.6)
91
+ libnotify (0.2.0)
92
+ ffi (>= 0.6.2)
88
93
  linecache (0.43)
89
94
  mime-types (1.16)
90
95
  mongo (1.0.7)
@@ -102,9 +107,18 @@ GEM
102
107
  plucky (0.3.4)
103
108
  mongo (~> 1.0.7)
104
109
  rake (0.8.7)
110
+ rb-inotify (0.8.1)
111
+ ffi (>= 0.5.0)
105
112
  rcov (0.9.8)
106
113
  rest-client (1.6.0)
107
114
  mime-types (>= 1.16)
115
+ rspactor (0.7.0.beta.6)
116
+ bundler (>= 1.0.0.rc.5)
117
+ growl (>= 1.0.3)
118
+ libnotify (>= 0.1.3)
119
+ rb-inotify
120
+ sys-uname (>= 0.8.4)
121
+ trollop (>= 1.16.2)
108
122
  rspec (1.3.0)
109
123
  ruby-debug (0.10.3)
110
124
  columnize (>= 0.1)
@@ -115,6 +129,7 @@ GEM
115
129
  json_pure (>= 1.1.7)
116
130
  sqlite3-ruby (1.3.1)
117
131
  stringex (1.1.0)
132
+ sys-uname (0.8.4)
118
133
  term-ansicolor (1.0.5)
119
134
  trollop (1.16.2)
120
135
  tzinfo (0.3.22)
@@ -139,6 +154,7 @@ DEPENDENCIES
139
154
  mongoid (= 1.9.1)
140
155
  rake
141
156
  rcov
157
+ rspactor
142
158
  rspec
143
159
  ruby-debug
144
160
  sqlite3-ruby
@@ -20,4 +20,4 @@ end
20
20
 
21
21
  Then /^I should see ([\d]+) widget in another db using mongoid$/ do |widget_count|
22
22
  MongoidWidgetUsingDatabaseTwo.count.should == widget_count.to_i
23
- end
23
+ end
@@ -38,7 +38,7 @@ if orm && strategy
38
38
 
39
39
 
40
40
 
41
- if multiple_db
41
+ if multiple_db
42
42
  DatabaseCleaner.app_root = "#{File.dirname(__FILE__)}/../.."
43
43
  orm_sym = orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym
44
44
 
@@ -46,4 +46,4 @@ class MongoidWidgetUsingDatabaseTwo
46
46
  new(*args).save!
47
47
  end
48
48
  end
49
- end
49
+ end
@@ -13,21 +13,21 @@ class FeatureRunner
13
13
  def go(feature)
14
14
  full_dir ||= File.expand_path(File.dirname(__FILE__) + "/../../examples/")
15
15
  Dir.chdir(full_dir) do
16
-
17
-
16
+
17
+
18
18
  ENV['ORM'] = orm
19
19
  ENV['STRATEGY'] = strategy
20
-
20
+
21
21
  if another_orm
22
22
  ENV['ANOTHER_ORM'] = another_orm
23
23
  else
24
24
  ENV['ANOTHER_ORM'] = nil
25
25
  end
26
-
26
+
27
27
  if multiple_databases
28
28
  ENV['MULTIPLE_DBS'] = "true"
29
29
  else
30
- ENV['MULTIPLE_DBS'] = nil
30
+ ENV['MULTIPLE_DBS'] = nil
31
31
  end
32
32
 
33
33
  self.output = `#{"jruby -S " if defined?(JRUBY_VERSION)}cucumber features/#{feature}.feature`
@@ -14,7 +14,7 @@ module DatabaseCleaner
14
14
  self.strategy_db = desired_db
15
15
  @db = desired_db
16
16
  end
17
-
17
+
18
18
  def strategy_db=(desired_db)
19
19
  if strategy.respond_to? :db=
20
20
  strategy.db = desired_db
@@ -54,7 +54,7 @@ module DatabaseCleaner
54
54
  end
55
55
 
56
56
  self.strategy_db = self.db
57
-
57
+
58
58
  @strategy
59
59
  end
60
60
 
@@ -45,10 +45,14 @@ module DatabaseCleaner
45
45
  self.connections.each { |connection| connection.clean }
46
46
  end
47
47
 
48
- def clean_with(stratagem)
49
- self.connections.each { |connection| connection.clean_with stratagem }
48
+ alias clean! clean
49
+
50
+ def clean_with(*args)
51
+ self.connections.each { |connection| connection.clean_with(*args) }
50
52
  end
51
53
 
54
+ alias clean_with! clean_with
55
+
52
56
  def remove_duplicates
53
57
  temp = []
54
58
  self.connections.each do |connect|
@@ -56,7 +60,7 @@ module DatabaseCleaner
56
60
  end
57
61
  @connections = temp
58
62
  end
59
-
63
+
60
64
  def orm_module(symbol)
61
65
  case symbol
62
66
  when :active_record
@@ -63,7 +63,7 @@ module DataMapper
63
63
  end
64
64
 
65
65
  end
66
-
66
+
67
67
  class SqliteAdapter < DataObjectsAdapter
68
68
  # taken from http://github.com/godfat/dm-mapping/tree/master
69
69
  def storage_names(repository = :default)
@@ -65,7 +65,7 @@ my_db:
65
65
  YAML.should_receive(:load).and_return( {:nil => nil} )
66
66
  subject.load_config
67
67
  end
68
-
68
+
69
69
  it "should process erb in the config" do
70
70
  transformed = <<-Y
71
71
  my_db:
@@ -4,7 +4,7 @@ require 'database_cleaner/data_mapper/transaction'
4
4
 
5
5
  module DatabaseCleaner
6
6
  describe Base do
7
-
7
+
8
8
  describe "autodetect" do
9
9
 
10
10
  #Cache all ORMs, we'll need them later but not now.
@@ -23,8 +23,8 @@ module DatabaseCleaner
23
23
  Object.send(:remove_const, 'MongoMapper') if defined?(::MongoMapper)
24
24
  Object.send(:remove_const, 'Mongoid') if defined?(::Mongoid)
25
25
  Object.send(:remove_const, 'CouchPotato') if defined?(::CouchPotato)
26
-
27
-
26
+
27
+
28
28
  # Restore ORMs
29
29
  ::ActiveRecord = Temp_AR if defined? Temp_AR
30
30
  ::DataMapper = Temp_DM if defined? Temp_DM
@@ -77,7 +77,7 @@ module DatabaseCleaner
77
77
  cleaner.orm.should == :mongo_mapper
78
78
  cleaner.should be_auto_detected
79
79
  end
80
-
80
+
81
81
  it "should detect Mongoid fourth" do
82
82
  Object.const_set('Mongoid', 'Mongoid mock')
83
83
  Object.const_set('CouchPotato', 'Couching mock potatos')
@@ -85,7 +85,7 @@ module DatabaseCleaner
85
85
  cleaner.orm.should == :mongoid
86
86
  cleaner.should be_auto_detected
87
87
  end
88
-
88
+
89
89
  it "should detect CouchPotato last" do
90
90
  Object.const_set('CouchPotato', 'Couching mock potatos')
91
91
 
@@ -93,19 +93,19 @@ module DatabaseCleaner
93
93
  cleaner.should be_auto_detected
94
94
  end
95
95
  end
96
-
96
+
97
97
  describe "orm_module" do
98
98
  it "should ask ::DatabaseCleaner what the module is for its orm" do
99
99
  orm = mock("orm")
100
100
  mockule = mock("module")
101
-
101
+
102
102
  cleaner = ::DatabaseCleaner::Base.new
103
103
  cleaner.should_receive(:orm).and_return(orm)
104
-
104
+
105
105
  ::DatabaseCleaner.should_receive(:orm_module).with(orm).and_return(mockule)
106
-
106
+
107
107
  cleaner.send(:orm_module).should == mockule
108
- end
108
+ end
109
109
  end
110
110
 
111
111
  describe "comparison" do
@@ -126,12 +126,12 @@ module DatabaseCleaner
126
126
  describe "initialization" do
127
127
  context "db specified" do
128
128
  subject { ::DatabaseCleaner::Base.new(:active_record,:connection => :my_db) }
129
-
129
+
130
130
  it "should store db from :connection in params hash" do
131
- subject.db.should == :my_db
131
+ subject.db.should == :my_db
132
132
  end
133
133
  end
134
-
134
+
135
135
  describe "orm" do
136
136
  it "should store orm" do
137
137
  cleaner = ::DatabaseCleaner::Base.new :a_orm
@@ -150,30 +150,30 @@ module DatabaseCleaner
150
150
 
151
151
  it "should default to autodetect upon initalisation" do
152
152
  subject.should be_auto_detected
153
- end
153
+ end
154
154
  end
155
155
  end
156
-
156
+
157
157
  describe "db" do
158
158
  it "should default to :default" do
159
159
  subject.db.should == :default
160
160
  end
161
-
161
+
162
162
  it "should return any stored db value" do
163
163
  subject.stub(:strategy_db=)
164
164
  subject.db = :test_db
165
165
  subject.db.should == :test_db
166
166
  end
167
-
167
+
168
168
  it "should pass db to any specified strategy" do
169
169
  subject.should_receive(:strategy_db=).with(:a_new_db)
170
170
  subject.db = :a_new_db
171
171
  end
172
172
  end
173
-
173
+
174
174
  describe "strategy_db=" do
175
175
  let(:strategy) { mock("strategy") }
176
-
176
+
177
177
  before(:each) do
178
178
  subject.strategy = strategy
179
179
  end
@@ -183,16 +183,16 @@ module DatabaseCleaner
183
183
  strategy.stub(:db=)
184
184
  subject.strategy_db = :a_db
185
185
  end
186
-
186
+
187
187
  context "when strategy supports db specification" do
188
188
  before(:each) { strategy.stub(:respond_to?).with(:db=).and_return true }
189
-
189
+
190
190
  it "should pass db to the strategy" do
191
191
  strategy.should_receive(:db=).with(:a_db)
192
192
  subject.strategy_db = :a_db
193
193
  end
194
- end
195
-
194
+ end
195
+
196
196
  context "when strategy doesn't supports db specification" do
197
197
  before(:each) { strategy.stub(:respond_to?).with(:db=).and_return false }
198
198
 
@@ -202,7 +202,7 @@ module DatabaseCleaner
202
202
 
203
203
  subject.strategy_db = db
204
204
  end
205
-
205
+
206
206
  it "should raise an argument error when db isn't default" do
207
207
  db = mock("a db")
208
208
  expect{ subject.strategy_db = db }.to raise_error ArgumentError
@@ -212,58 +212,58 @@ module DatabaseCleaner
212
212
 
213
213
  describe "clean_with" do
214
214
  let (:strategy) { mock("strategy",:clean => true) }
215
-
215
+
216
216
  before(:each) { subject.stub(:create_strategy).with(anything).and_return(strategy) }
217
-
217
+
218
218
  it "should pass all arguments to create_strategy" do
219
219
  subject.should_receive(:create_strategy).with(:lorum, :dollar, :amet, :ipsum => "random").and_return(strategy)
220
220
  subject.clean_with :lorum, :dollar, :amet, { :ipsum => "random" }
221
221
  end
222
-
222
+
223
223
  it "should invoke clean on the created strategy" do
224
224
  strategy.should_receive(:clean)
225
225
  subject.clean_with :strategy
226
226
  end
227
-
227
+
228
228
  it "should return the strategy" do
229
229
  subject.clean_with( :strategy ).should == strategy
230
230
  end
231
231
  end
232
-
232
+
233
233
  describe "clean_with!" do
234
234
  let (:strategy) { mock("strategy",:clean => true) }
235
-
235
+
236
236
  before(:each) { subject.stub(:create_strategy).with(anything).and_return(strategy) }
237
-
237
+
238
238
  it "should pass all arguments to create_strategy" do
239
239
  subject.should_receive(:create_strategy).with(:lorum, :dollar, :amet, :ipsum => "random").and_return(strategy)
240
240
  subject.clean_with! :lorum, :dollar, :amet, { :ipsum => "random" }
241
241
  end
242
-
242
+
243
243
  it "should invoke clean on the created strategy" do
244
244
  strategy.should_receive(:clean)
245
245
  subject.clean_with! :strategy
246
246
  end
247
-
247
+
248
248
  it "should return the strategy" do
249
249
  subject.clean_with!( :strategy ).should == strategy
250
250
  end
251
251
  end
252
-
252
+
253
253
  describe "create_strategy" do
254
254
  let(:klass) { mock("klass",:new => mock("instance")) }
255
-
255
+
256
256
  before :each do
257
257
  subject.stub(:orm_strategy).and_return(klass)
258
258
  end
259
-
259
+
260
260
  it "should pass the first argument to orm_strategy" do
261
261
  subject.should_receive(:orm_strategy).with(:strategy).and_return(Object)
262
262
  subject.create_strategy :strategy
263
263
  end
264
264
  it "should pass the remainding argument to orm_strategy.new" do
265
265
  klass.should_receive(:new).with(:params => {:lorum => "ipsum"})
266
-
266
+
267
267
  subject.create_strategy :strategy, {:params => {:lorum => "ipsum"}}
268
268
  end
269
269
  it "should return the resulting strategy" do
@@ -273,31 +273,31 @@ module DatabaseCleaner
273
273
 
274
274
  describe "strategy=" do
275
275
  let(:mock_strategy) { mock("strategy") }
276
-
276
+
277
277
  it "should proxy symbolised strategies to create_strategy" do
278
278
  subject.should_receive(:create_strategy).with(:symbol)
279
279
  subject.strategy = :symbol
280
280
  end
281
-
281
+
282
282
  it "should proxy params with symbolised strategies" do
283
283
  subject.should_receive(:create_strategy).with(:symbol,:param => "one")
284
284
  subject.strategy= :symbol, {:param => "one"}
285
285
  end
286
-
286
+
287
287
  it "should accept strategy objects" do
288
288
  expect{ subject.strategy = mock_strategy }.to_not raise_error
289
289
  end
290
-
290
+
291
291
  it "should raise argument error when params given with strategy Object" do
292
292
  expect{ subject.strategy = mock("object"), {:param => "one"} }.to raise_error ArgumentError
293
293
  end
294
-
294
+
295
295
  it "should attempt to set strategy db" do
296
296
  subject.stub(:db).and_return(:my_db)
297
297
  subject.should_receive(:strategy_db=).with(:my_db)
298
298
  subject.strategy = mock_strategy
299
299
  end
300
-
300
+
301
301
  it "should return the stored strategy" do
302
302
  result = subject.strategy = mock_strategy
303
303
  result.should == mock_strategy
@@ -309,14 +309,14 @@ module DatabaseCleaner
309
309
  subject.instance_values["@strategy"] = nil
310
310
  expect{ subject.strategy }.to raise_error NoStrategySetError
311
311
  end
312
-
312
+
313
313
  it "should return @strategy if @strategy is present" do
314
314
  strategum = mock("strategy")
315
315
  subject.strategy = strategum
316
316
  subject.strategy.should == strategum
317
317
  end
318
318
  end
319
-
319
+
320
320
  describe "orm=" do
321
321
  it "should stored the desired orm" do
322
322
  subject.orm.should_not == :desired_orm
@@ -327,12 +327,12 @@ module DatabaseCleaner
327
327
 
328
328
  describe "orm" do
329
329
  let(:mock_orm) { mock("orm") }
330
-
330
+
331
331
  it "should return orm if orm set" do
332
332
  subject.instance_variable_set "@orm", mock_orm
333
333
  subject.orm.should == mock_orm
334
334
  end
335
-
335
+
336
336
  context "orm isn't set" do
337
337
  before(:each) { subject.instance_variable_set "@orm", nil }
338
338
 
@@ -350,25 +350,25 @@ module DatabaseCleaner
350
350
 
351
351
  describe "proxy methods" do
352
352
  let (:strategy) { mock("strategy") }
353
-
353
+
354
354
  before(:each) do
355
355
  subject.stub(:strategy).and_return(strategy)
356
356
  end
357
-
357
+
358
358
  describe "start" do
359
359
  it "should proxy start to the strategy" do
360
360
  strategy.should_receive(:start)
361
361
  subject.start
362
362
  end
363
363
  end
364
-
364
+
365
365
  describe "clean" do
366
366
  it "should proxy clean to the strategy" do
367
367
  strategy.should_receive(:clean)
368
368
  subject.clean
369
369
  end
370
370
  end
371
-
371
+
372
372
  describe "clean!" do
373
373
  it "should proxy clean! to the strategy clean" do
374
374
  strategy.should_receive(:clean)
@@ -376,66 +376,66 @@ module DatabaseCleaner
376
376
  end
377
377
  end
378
378
  end
379
-
379
+
380
380
  describe "auto_detected?" do
381
381
  it "should return true unless @autodetected is nil" do
382
382
  subject.instance_variable_set("@autodetected","not nil")
383
383
  subject.auto_detected?.should be_true
384
384
  end
385
-
385
+
386
386
  it "should return false if @autodetect is nil" do
387
387
  subject.instance_variable_set("@autodetected",nil)
388
388
  subject.auto_detected?.should be_false
389
389
  end
390
390
  end
391
-
391
+
392
392
  describe "orm_strategy" do
393
393
  let (:klass) { mock("klass") }
394
-
394
+
395
395
  before(:each) do
396
396
  subject.stub(:orm_module).and_return(klass)
397
397
  end
398
-
398
+
399
399
  context "in response to a LoadError" do
400
400
  before(:each) { subject.should_receive(:require).with(anything).and_raise(LoadError) }
401
401
 
402
402
  it "should catch LoadErrors" do
403
403
  expect { subject.send(:orm_strategy,:a_strategy) }.to_not raise_error LoadError
404
404
  end
405
-
405
+
406
406
  it "should raise UnknownStrategySpecified" do
407
407
  expect { subject.send(:orm_strategy,:a_strategy) }.to raise_error UnknownStrategySpecified
408
408
  end
409
-
409
+
410
410
  it "should ask orm_module if it will list available_strategies" do
411
411
  klass.should_receive(:respond_to?).with(:available_strategies)
412
-
412
+
413
413
  subject.stub(:orm_module).and_return(klass)
414
-
414
+
415
415
  expect { subject.send(:orm_strategy,:a_strategy) }.to raise_error UnknownStrategySpecified
416
416
  end
417
-
417
+
418
418
  it "should use available_strategies (for the error message) if its available" do
419
419
  klass.stub(:respond_to?).with(:available_strategies).and_return(true)
420
420
  klass.should_receive(:available_strategies).and_return([])
421
-
421
+
422
422
  subject.stub(:orm_module).and_return(klass)
423
-
423
+
424
424
  expect { subject.send(:orm_strategy,:a_strategy) }.to raise_error UnknownStrategySpecified
425
425
  end
426
426
  end
427
-
427
+
428
428
  it "should return the constant of the Strategy class requested" do
429
429
  strategy_klass = mock("strategy klass")
430
-
430
+
431
431
  subject.stub(:require).with(anything).and_return(true)
432
-
432
+
433
433
  klass.should_receive(:const_get).with("Cunningplan").and_return(strategy_klass)
434
-
434
+
435
435
  subject.send(:orm_strategy, :cunningplan).should == strategy_klass
436
436
  end
437
-
437
+
438
438
  end
439
-
439
+
440
440
  end
441
441
  end
@@ -48,7 +48,7 @@ describe ::DatabaseCleaner do
48
48
  ::DatabaseCleaner.connections.size.should == 1
49
49
  end
50
50
  end
51
-
51
+
52
52
  it "should accept multiple orm's" do
53
53
  ::DatabaseCleaner[:couch_potato]
54
54
  ::DatabaseCleaner[:data_mapper]
@@ -64,7 +64,7 @@ describe ::DatabaseCleaner do
64
64
  cleaner.orm.should == :active_record
65
65
  cleaner.db.should == :first_connection
66
66
  end
67
-
67
+
68
68
  it "should accept multiple connections for a single orm" do
69
69
  ::DatabaseCleaner[:data_mapper,{:connection => :first_db}]
70
70
  ::DatabaseCleaner[:data_mapper,{:connection => :second_db}]
@@ -74,7 +74,7 @@ describe ::DatabaseCleaner do
74
74
  ::DatabaseCleaner.connections[1].orm.should == :data_mapper
75
75
  ::DatabaseCleaner.connections[1].db.should == :second_db
76
76
  end
77
-
77
+
78
78
  it "should accept multiple connections and multiple orms" do
79
79
  ::DatabaseCleaner[:data_mapper, {:connection => :first_db} ]
80
80
  ::DatabaseCleaner[:active_record,{:connection => :second_db}]
@@ -146,8 +146,8 @@ describe ::DatabaseCleaner do
146
146
 
147
147
  it "should proxy clean_with" do
148
148
  stratagem = mock("stratgem")
149
- connection.should_receive(:clean_with).with(stratagem)
150
- ::DatabaseCleaner.clean_with stratagem
149
+ connection.should_receive(:clean_with).with(stratagem, {})
150
+ ::DatabaseCleaner.clean_with stratagem, {}
151
151
  end
152
152
  end
153
153
 
@@ -238,7 +238,7 @@ describe ::DatabaseCleaner do
238
238
  it "should remove duplicates if they are identical" do
239
239
  orm = mock("orm")
240
240
  connection = mock("a datamapper connection", :orm => orm )
241
-
241
+
242
242
  ::DatabaseCleaner.connections_stub! [connection,connection,connection]
243
243
 
244
244
  ::DatabaseCleaner.remove_duplicates
@@ -256,39 +256,39 @@ describe ::DatabaseCleaner do
256
256
  DatabaseCleaner.app_root.should == '/path/to'
257
257
  end
258
258
  end
259
-
259
+
260
260
  describe "orm_module" do
261
261
  subject { ::DatabaseCleaner }
262
-
262
+
263
263
  it "should return DatabaseCleaner::ActiveRecord for :active_record" do
264
264
  ::DatabaseCleaner::ActiveRecord = mock("ar module") unless defined? ::DatabaseCleaner::ActiveRecord
265
265
  subject.orm_module(:active_record).should == DatabaseCleaner::ActiveRecord
266
266
  end
267
-
267
+
268
268
  it "should return DatabaseCleaner::DataMapper for :data_mapper" do
269
269
  ::DatabaseCleaner::DataMapper = mock("dm module") unless defined? ::DatabaseCleaner::DataMapper
270
270
  subject.orm_module(:data_mapper).should == DatabaseCleaner::DataMapper
271
271
  end
272
-
272
+
273
273
  it "should return DatabaseCleaner::MongoMapper for :mongo_mapper" do
274
274
  ::DatabaseCleaner::MongoMapper = mock("mm module") unless defined? ::DatabaseCleaner::MongoMapper
275
275
  subject.orm_module(:mongo_mapper).should == DatabaseCleaner::MongoMapper
276
276
  end
277
-
277
+
278
278
  it "should return DatabaseCleaner::Mongoid for :mongoid" do
279
279
  ::DatabaseCleaner::Mongoid = mock("mongoid module") unless defined? ::DatabaseCleaner::Mongoid
280
280
  subject.orm_module(:mongoid).should == DatabaseCleaner::Mongoid
281
281
  end
282
-
282
+
283
283
  it "should return DatabaseCleaner::Mongo for :mongo" do
284
284
  ::DatabaseCleaner::Mongo = mock("mongo module") unless defined? ::DatabaseCleaner::Mongo
285
285
  subject.orm_module(:mongo).should == DatabaseCleaner::Mongo
286
286
  end
287
-
287
+
288
288
  it "should return DatabaseCleaner::CouchPotato for :couch_potato" do
289
289
  ::DatabaseCleaner::CouchPotato = mock("cp module") unless defined? ::DatabaseCleaner::CouchPotato
290
290
  subject.orm_module(:couch_potato).should == DatabaseCleaner::CouchPotato
291
291
  end
292
-
292
+
293
293
  end
294
294
  end
@@ -30,7 +30,7 @@ module DatabaseCleaner
30
30
  end
31
31
 
32
32
  def ensure_counts(expected_counts)
33
- # I had to add this sanity_check garbage because I was getting non-determinisc results from mongomapper at times..
33
+ # I had to add this sanity_check garbage because I was getting non-determinisc results from mongomapper at times..
34
34
  # very odd and disconcerting...
35
35
  sanity_check = expected_counts.delete(:sanity_check)
36
36
  begin
data/spec/spec_helper.rb CHANGED
@@ -13,7 +13,7 @@ require 'database_cleaner'
13
13
 
14
14
 
15
15
  Spec::Runner.configure do |config|
16
-
16
+
17
17
  end
18
18
 
19
19
  alias running lambda
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_cleaner
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424119
4
+ hash: 15424113
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
9
  - 0
10
10
  - rc
11
- - 1
12
- version: 0.6.0.rc.1
11
+ - 2
12
+ version: 0.6.0.rc.2
13
13
  platform: ruby
14
14
  authors:
15
15
  - Ben Mabey
@@ -40,13 +40,7 @@ files:
40
40
  - cucumber.yml
41
41
  - examples/Gemfile
42
42
  - examples/Gemfile.lock
43
- - examples/config/database.yml
44
43
  - examples/config/database.yml.example
45
- - examples/db/activerecord_one.db
46
- - examples/db/activerecord_two.db
47
- - examples/db/datamapper_default.db
48
- - examples/db/datamapper_one.db
49
- - examples/db/datamapper_two.db
50
44
  - examples/db/sqlite_databases_go_here
51
45
  - examples/features/example.feature
52
46
  - examples/features/example_multiple_db.feature
@@ -1,7 +0,0 @@
1
- ---
2
- two:
3
- adapter: sqlite3
4
- database: /Users/bmabey/Programming/ruby/database_cleaner/examples/features/support/../../db/activerecord_two.db
5
- one:
6
- adapter: sqlite3
7
- database: /Users/bmabey/Programming/ruby/database_cleaner/examples/features/support/../../db/activerecord_one.db
Binary file
Binary file
Binary file
Binary file
Binary file