public
Fork of sam/dm-core
Description: DataMapper - Core
Homepage: http://datamapper.org
Clone URL: git://github.com/thewordnerd/dm-core.git
Added deprecation warning for Model#create!. Removed all calls to create! 
in specs. This resolves #428.
Wed Jul 23 09:26:27 -0700 2008
commit  c27a67f6d960d2edd41cd8b6ae3bfee218293816
tree    bbb253092baf49b0d23c72c7838bbdfbf21f5b13
parent  b3ba958502dcea20072e24dde849e37e0b384328
...
39
40
41
42
 
43
44
45
...
261
262
263
264
265
266
267
268
 
 
269
 
270
271
272
...
39
40
41
 
42
43
44
45
...
261
262
263
 
 
 
 
 
264
265
266
267
268
269
270
0
@@ -39,7 +39,7 @@ module DataMapper
0
       target.instance_variable_set(:@properties, Hash.new { |h,k| h[k] = k == Repository.default_name ? PropertySet.new : h[Repository.default_name].dup })
0
       target.instance_variable_set(:@base_model, self.base_model)
0
       target.instance_variable_set(:@paranoid_properties, @paranoid_properties)
0
- target.instance_variable_set(:@validations, @validations) if self.respond_to?(:validators)
0
+ target.instance_variable_set(:@validations, @validations.dup) if self.respond_to?(:validators)
0
 
0
       @properties.each do |repository_name,properties|
0
         repository(repository_name) do
0
@@ -261,12 +261,10 @@ module DataMapper
0
     end
0
 
0
     ##
0
- # Dangerous version of #create. Raises if there is a failure
0
- #
0
- # @see DataMapper::Resource#create
0
- # @param <Hash(Symbol => Object)> attributes hash of attributes to set
0
- # @raise <PersistenceError> The resource could not be saved
0
+ # This method is deprecated, and will be removed from dm-core.
0
+ #
0
     def create!(attributes = {})
0
+ warn("Model#create! is deprecated. It is moving to dm-validations, and will be used to create a record without validations")
0
       resource = create(attributes)
0
       raise PersistenceError, "Resource not saved: :new_record => #{resource.new_record?}, :dirty_attributes => #{resource.dirty_attributes.inspect}" if resource.new_record?
0
       resource
...
36
37
38
39
 
40
41
42
...
256
257
258
259
 
260
261
262
...
275
276
277
278
279
280
281
 
 
 
 
282
283
284
...
321
322
323
324
 
325
326
327
...
332
333
334
335
 
336
337
338
...
343
344
345
346
347
 
 
348
349
350
...
365
366
367
368
 
369
370
371
...
378
379
380
381
382
383
 
 
 
384
385
386
...
414
415
416
417
 
418
419
420
421
422
423
 
424
425
426
...
428
429
430
431
432
 
 
433
434
435
...
451
452
453
454
455
456
457
458
 
 
 
 
 
459
460
461
...
577
578
579
580
 
581
582
583
...
609
610
611
612
613
614
615
616
617
 
 
 
 
 
 
618
619
620
...
638
639
640
641
 
642
643
644
...
36
37
38
 
39
40
41
42
...
256
257
258
 
259
260
261
262
...
275
276
277
 
 
 
 
278
279
280
281
282
283
284
...
321
322
323
 
324
325
326
327
...
332
333
334
 
335
336
337
338
...
343
344
345
 
 
346
347
348
349
350
...
365
366
367
 
368
369
370
371
...
378
379
380
 
 
 
381
382
383
384
385
386
...
414
415
416
 
417
418
419
420
421
422
 
423
424
425
426
...
428
429
430
 
 
431
432
433
434
435
...
451
452
453
 
 
 
 
 
454
455
456
457
458
459
460
461
...
577
578
579
 
580
581
582
583
...
609
610
611
 
 
 
 
 
 
612
613
614
615
616
617
618
619
620
...
638
639
640
 
641
642
643
644
0
@@ -36,7 +36,7 @@ if HAS_SQLITE3
0
     before :each do
0
       [ CustomChild, CustomParent ].each { |m| m.auto_migrate! }
0
 
0
- parent = CustomParent.create!(:name => "mother")
0
+ parent = CustomParent.create(:name => "mother")
0
       child1 = parent.custom_childs.create(:name => "son")
0
       child2 = parent.custom_childs.create(:name => "daughter")
0
 
0
@@ -256,7 +256,7 @@ if ADAPTER
0
 
0
       it 'should allow namespaced classes in parent and child for one <=> one' do
0
         g = Models::Goal.new(:title => "g2", :summary => "desc 2")
0
- p = Models::Project.create!(:title => "p2", :summary => "sum 2", :goal => g)
0
+ p = Models::Project.create(:title => "p2", :summary => "sum 2", :goal => g)
0
 
0
         pp = Models::Project.first(:title => 'p2')
0
         pp.goal.title.should == "g2"
0
@@ -275,10 +275,10 @@ if ADAPTER
0
         Machine.auto_migrate!(ADAPTER)
0
         Area.auto_migrate!(ADAPTER)
0
 
0
- machine1 = Machine.create!(:name => 'machine1')
0
- machine2 = Machine.create!(:name => 'machine2')
0
- area1 = Area.create!(:name => 'area1', :machine => machine1)
0
- area2 = Area.create!(:name => 'area2')
0
+ machine1 = Machine.create(:name => 'machine1')
0
+ machine2 = Machine.create(:name => 'machine2')
0
+ area1 = Area.create(:name => 'area1', :machine => machine1)
0
+ area2 = Area.create(:name => 'area2')
0
       end
0
 
0
       it '#belongs_to' do
0
@@ -321,7 +321,7 @@ if ADAPTER
0
       it 'should save the association key in the child' do
0
         machine2 = Machine.first(:name => 'machine2')
0
 
0
- Area.create!(:name => 'area3', :machine => machine2)
0
+ Area.create(:name => 'area3', :machine => machine2)
0
         Area.first(:name => 'area3').machine.should == machine2
0
       end
0
 
0
@@ -332,7 +332,7 @@ if ADAPTER
0
 
0
       it 'should save the parent upon saving of child' do
0
         e = Machine.new(:name => 'machine10')
0
- y = Area.create!(:name => 'area10', :machine => e)
0
+ y = Area.create(:name => 'area10', :machine => e)
0
 
0
         y.machine.name.should == 'machine10'
0
         Machine.first(:name => 'machine10').should_not be_nil
0
@@ -343,8 +343,8 @@ if ADAPTER
0
       end
0
 
0
       it 'should save nil parents as NULL ids' do
0
- y1 = Area.create!(:id => 20, :name => 'area20')
0
- y2 = Area.create!(:id => 30, :name => 'area30', :machine => nil)
0
+ y1 = Area.create(:id => 20, :name => 'area20')
0
+ y2 = Area.create(:id => 30, :name => 'area30', :machine => nil)
0
 
0
         y1.id.should == 20
0
         y1.machine.should be_nil
0
@@ -365,7 +365,7 @@ if ADAPTER
0
 
0
       it 'should be reloaded when calling Resource#reload' do
0
         e = Machine.new(:name => 'machine40')
0
- y = Area.create!(:name => 'area40', :machine => e)
0
+ y = Area.create(:name => 'area40', :machine => e)
0
 
0
         y.send(:machine_association).should_receive(:reload).once
0
 
0
@@ -378,9 +378,9 @@ if ADAPTER
0
         Sky.auto_migrate!(ADAPTER)
0
         Pie.auto_migrate!(ADAPTER)
0
 
0
- pie1 = Pie.create!(:name => 'pie1')
0
- pie2 = Pie.create!(:name => 'pie2')
0
- sky1 = Sky.create!(:name => 'sky1', :pie => pie1)
0
+ pie1 = Pie.create(:name => 'pie1')
0
+ pie2 = Pie.create(:name => 'pie2')
0
+ sky1 = Sky.create(:name => 'sky1', :pie => pie1)
0
       end
0
 
0
       it '#has 1' do
0
@@ -414,13 +414,13 @@ if ADAPTER
0
       it 'should save the association key in the child' do
0
         pie2 = Pie.first(:name => 'pie2')
0
 
0
- sky2 = Sky.create!(:id => 2, :name => 'sky2', :pie => pie2)
0
+ sky2 = Sky.create(:id => 2, :name => 'sky2', :pie => pie2)
0
         pie2.sky.should == sky2
0
       end
0
 
0
       it 'should save the children upon saving of parent' do
0
         p = Pie.new(:id => 10, :name => 'pie10')
0
- s = Sky.create!(:id => 10, :name => 'sky10', :pie => p)
0
+ s = Sky.create(:id => 10, :name => 'sky10', :pie => p)
0
 
0
         p.sky.should == s
0
 
0
@@ -428,8 +428,8 @@ if ADAPTER
0
       end
0
 
0
       it 'should save nil parents as NULL ids' do
0
- p1 = Pie.create!(:id => 20, :name => 'pie20')
0
- p2 = Pie.create!(:id => 30, :name => 'pie30', :sky => nil)
0
+ p1 = Pie.create(:id => 20, :name => 'pie20')
0
+ p2 = Pie.create(:id => 30, :name => 'pie30', :sky => nil)
0
 
0
         p1.id.should == 20
0
         p1.sky.should be_nil
0
@@ -451,11 +451,11 @@ if ADAPTER
0
         Machine.auto_migrate!(ADAPTER)
0
         Area.auto_migrate!(ADAPTER)
0
 
0
- ultrahost1 = Ultrahost.create!(:name => 'ultrahost1')
0
- ultrahost2 = Ultrahost.create!(:name => 'ultrahost2')
0
- ultraslice1 = Ultraslice.create!(:name => 'ultraslice1', :ultrahost => ultrahost1)
0
- ultraslice2 = Ultraslice.create!(:name => 'ultraslice2', :ultrahost => ultrahost1)
0
- ultraslice3 = Ultraslice.create!(:name => 'ultraslice3')
0
+ ultrahost1 = Ultrahost.create(:name => 'ultrahost1')
0
+ ultrahost2 = Ultrahost.create(:name => 'ultrahost2')
0
+ ultraslice1 = Ultraslice.create(:name => 'ultraslice1', :ultrahost => ultrahost1)
0
+ ultraslice2 = Ultraslice.create(:name => 'ultraslice2', :ultrahost => ultrahost1)
0
+ ultraslice3 = Ultraslice.create(:name => 'ultraslice3')
0
       end
0
 
0
       it '#has n' do
0
@@ -577,7 +577,7 @@ if ADAPTER
0
       end
0
 
0
       it 'should save the associated instances upon saving of parent when mass-assigned' do
0
- h = Ultrahost.create!(:id => 10, :name => 'ultrahost10', :ultraslices => [ Ultraslice.new(:id => 10, :name => 'ultraslice10') ])
0
+ h = Ultrahost.create(:id => 10, :name => 'ultrahost10', :ultraslices => [ Ultraslice.new(:id => 10, :name => 'ultraslice10') ])
0
 
0
         s = Ultraslice.first(:name => 'ultraslice10')
0
 
0
@@ -609,12 +609,12 @@ if ADAPTER
0
       before do
0
         Node.auto_migrate!(ADAPTER)
0
 
0
- Node.create!(:name => 'r1')
0
- Node.create!(:name => 'r2')
0
- Node.create!(:name => 'r1c1', :parent_id => 1)
0
- Node.create!(:name => 'r1c2', :parent_id => 1)
0
- Node.create!(:name => 'r1c3', :parent_id => 1)
0
- Node.create!(:name => 'r1c1c1', :parent_id => 3)
0
+ Node.create(:name => 'r1')
0
+ Node.create(:name => 'r2')
0
+ Node.create(:name => 'r1c1', :parent_id => 1)
0
+ Node.create(:name => 'r1c2', :parent_id => 1)
0
+ Node.create(:name => 'r1c3', :parent_id => 1)
0
+ Node.create(:name => 'r1c1c1', :parent_id => 3)
0
       end
0
 
0
       it 'should properly set #parent' do
0
@@ -638,7 +638,7 @@ if ADAPTER
0
       end
0
 
0
       it 'should allow to create root nodes' do
0
- r = Node.create!(:name => 'newroot')
0
+ r = Node.create(:name => 'newroot')
0
         r.parent.should be_nil
0
         r.children.size.should == 0
0
       end
...
30
31
32
33
34
 
 
35
36
37
...
30
31
32
 
 
33
34
35
36
37
0
@@ -30,8 +30,8 @@ describe "OneToMany" do
0
 
0
     [Team, Player].each { |k| k.auto_migrate!(ADAPTER) }
0
 
0
- Team.create!(:name => "Cowboys")
0
- BaseballTeam.create!(:name => "Giants")
0
+ Team.create(:name => "Cowboys")
0
+ BaseballTeam.create(:name => "Giants")
0
   end
0
 
0
   it "unsaved parent model should accept array of hashes for association" do
...
564
565
566
567
 
568
569
570
...
578
579
580
581
 
582
583
584
...
564
565
566
 
567
568
569
570
...
578
579
580
 
581
582
583
584
0
@@ -564,7 +564,7 @@ if ADAPTER
0
 
0
           it 'should not find a resource not in the collection' do
0
             @query.update(:offset => 0, :limit => 3)
0
- @david = Zebra.create!(:name => 'David', :age => 15, :notes => 'Albino')
0
+ @david = Zebra.create(:name => 'David', :age => 15, :notes => 'Albino')
0
             @collection.get(@david.key).should be_nil
0
           end
0
         end
0
@@ -578,7 +578,7 @@ if ADAPTER
0
 
0
           it 'should raise an exception if the resource is not found' do
0
             @query.update(:offset => 0, :limit => 3)
0
- @david = Zebra.create!(:name => 'David', :age => 15, :notes => 'Albino')
0
+ @david = Zebra.create(:name => 'David', :age => 15, :notes => 'Albino')
0
             lambda {
0
               @collection.get!(@david.key)
0
             }.should raise_error(DataMapper::ObjectNotFoundError)
...
146
147
148
149
 
150
151
152
...
388
389
390
391
392
393
 
 
 
394
395
396
...
436
437
438
439
440
441
 
 
 
442
443
444
...
480
481
482
483
 
484
485
486
...
592
593
594
595
 
596
597
598
...
146
147
148
 
149
150
151
152
...
388
389
390
 
 
 
391
392
393
394
395
396
...
436
437
438
 
 
 
439
440
441
442
443
444
...
480
481
482
 
483
484
485
486
...
592
593
594
 
595
596
597
598
0
@@ -146,7 +146,7 @@ if HAS_POSTGRES
0
         pending "This works, but no create-schema support in PostgresAdapter to easily test with"
0
         lambda do
0
           repository(:postgres) do
0
- Voyager.create!(:age => 1_000)
0
+ Voyager.create(:age => 1_000)
0
           end
0
         end.should_not raise_error
0
       end
0
@@ -388,9 +388,9 @@ if HAS_POSTGRES
0
         SailBoat.auto_migrate!(:postgres)
0
 
0
         repository(:postgres) do
0
- SailBoat.create!(:id => 1, :name => "A", :port => "C")
0
- SailBoat.create!(:id => 2, :name => "B", :port => "B")
0
- SailBoat.create!(:id => 3, :name => "C", :port => "A")
0
+ SailBoat.create(:id => 1, :name => "A", :port => "C")
0
+ SailBoat.create(:id => 2, :name => "B", :port => "B")
0
+ SailBoat.create(:id => 3, :name => "C", :port => "A")
0
         end
0
       end
0
 
0
@@ -436,9 +436,9 @@ if HAS_POSTGRES
0
         SailBoat.auto_migrate!(:postgres)
0
 
0
         repository(:postgres) do
0
- SailBoat.create!(:id => 1, :notes=>'Note',:trip_report=>'Report',:miles=>23)
0
- SailBoat.create!(:id => 2, :notes=>'Note',:trip_report=>'Report',:miles=>23)
0
- SailBoat.create!(:id => 3, :notes=>'Note',:trip_report=>'Report',:miles=>23)
0
+ SailBoat.create(:id => 1, :notes=>'Note',:trip_report=>'Report',:miles=>23)
0
+ SailBoat.create(:id => 2, :notes=>'Note',:trip_report=>'Report',:miles=>23)
0
+ SailBoat.create(:id => 3, :notes=>'Note',:trip_report=>'Report',:miles=>23)
0
         end
0
       end
0
 
0
@@ -480,7 +480,7 @@ if HAS_POSTGRES
0
 
0
         repository(:postgres) do
0
           100.times do
0
- SerialFinderSpec.create!(:sample => rand.to_s)
0
+ SerialFinderSpec.create(:sample => rand.to_s)
0
           end
0
         end
0
       end
0
@@ -592,7 +592,7 @@ if HAS_POSTGRES
0
       it 'should save the association key in the child' do
0
         repository(:postgres) do
0
           e = Engine.first(:id => 2)
0
- Yard.create!(:id => 2, :name => 'yard2', :engine => e)
0
+ Yard.create(:id => 2, :name => 'yard2', :engine => e)
0
         end
0
 
0
         repository(:postgres) do
...
78
79
80
81
 
82
83
84
...
94
95
96
97
 
98
99
100
...
109
110
111
112
 
113
114
115
...
142
143
144
145
146
147
 
 
 
148
149
150
...
220
221
222
223
 
224
225
226
...
78
79
80
 
81
82
83
84
...
94
95
96
 
97
98
99
100
...
109
110
111
 
112
113
114
115
...
142
143
144
 
 
 
145
146
147
148
149
150
...
220
221
222
 
223
224
225
226
0
@@ -78,7 +78,7 @@ if ADAPTER
0
 
0
       it "should track on :load" do
0
         repository(ADAPTER) do
0
- jan = Actor.create!(:name => 'jan', :lead => true)
0
+ jan = Actor.create(:name => 'jan', :lead => true)
0
           jan.lead = false
0
           jan.original_values[:lead].should be_true
0
           jan.dirty?.should == true
0
@@ -94,7 +94,7 @@ if ADAPTER
0
       it "should track on :hash" do
0
         cv = { 2005 => "Othello" }
0
         repository(ADAPTER) do
0
- tom = Actor.create!(:name => 'tom', :cv => cv)
0
+ tom = Actor.create(:name => 'tom', :cv => cv)
0
         end
0
         repository(ADAPTER) do
0
           tom = Actor.first(:name => 'tom')
0
@@ -109,7 +109,7 @@ if ADAPTER
0
 
0
       it "should track with lazy text fields (#342)" do
0
         repository(ADAPTER) do
0
- tim = Actor.create!(:name => 'tim')
0
+ tim = Actor.create(:name => 'tim')
0
         end
0
         repository(ADAPTER) do
0
           tim = Actor.first(:name => 'tim')
0
@@ -142,9 +142,9 @@ if ADAPTER
0
         RowBoat.auto_migrate!(ADAPTER)
0
 
0
         repository(ADAPTER) do
0
- RowBoat.create!(:id => 1, :notes=>'Note',:trip_report=>'Report',:miles=>23)
0
- RowBoat.create!(:id => 2, :notes=>'Note',:trip_report=>'Report',:miles=>23)
0
- RowBoat.create!(:id => 3, :notes=>'Note',:trip_report=>'Report',:miles=>23)
0
+ RowBoat.create(:id => 1, :notes=>'Note',:trip_report=>'Report',:miles=>23)
0
+ RowBoat.create(:id => 2, :notes=>'Note',:trip_report=>'Report',:miles=>23)
0
+ RowBoat.create(:id => 3, :notes=>'Note',:trip_report=>'Report',:miles=>23)
0
         end
0
       end
0
 
0
@@ -220,7 +220,7 @@ if ADAPTER
0
 
0
       it "should have defaults even with creates" do
0
         repository(ADAPTER) do
0
- Catamaran.create!(:name => 'Jingle All The Way')
0
+ Catamaran.create(:name => 'Jingle All The Way')
0
           cat = Catamaran.first
0
           cat.name.should == 'Jingle All The Way'
0
           cat.could_be_bool0.should == true
...
131
132
133
134
135
136
 
 
 
137
138
139
...
206
207
208
209
210
211
 
 
 
212
213
214
...
227
228
229
230
 
231
232
233
...
287
288
289
290
291
292
 
 
 
293
294
295
296
 
 
297
298
299
300
 
 
301
302
303
...
131
132
133
 
 
 
134
135
136
137
138
139
...
206
207
208
 
 
 
209
210
211
212
213
214
...
227
228
229
 
230
231
232
233
...
287
288
289
 
 
 
290
291
292
293
294
 
 
295
296
297
298
 
 
299
300
301
302
303
0
@@ -131,9 +131,9 @@ if ADAPTER
0
       before do
0
         QuerySpec::SailBoat.auto_migrate!
0
 
0
- QuerySpec::SailBoat.create!(:name => 'A', :port => 'C')
0
- QuerySpec::SailBoat.create!(:name => 'B', :port => 'B')
0
- QuerySpec::SailBoat.create!(:name => 'C', :port => 'A')
0
+ QuerySpec::SailBoat.create(:name => 'A', :port => 'C')
0
+ QuerySpec::SailBoat.create(:name => 'B', :port => 'B')
0
+ QuerySpec::SailBoat.create(:name => 'C', :port => 'A')
0
       end
0
 
0
       def parse_statement(log)
0
@@ -206,9 +206,9 @@ if ADAPTER
0
       before do
0
         QuerySpec::SailBoat.auto_migrate!
0
 
0
- QuerySpec::SailBoat.create!(:name => 'A', :port => 'C')
0
- QuerySpec::SailBoat.create!(:name => 'B', :port => 'B')
0
- QuerySpec::SailBoat.create!(:name => 'C', :port => 'A')
0
+ QuerySpec::SailBoat.create(:name => 'A', :port => 'C')
0
+ QuerySpec::SailBoat.create(:name => 'B', :port => 'B')
0
+ QuerySpec::SailBoat.create(:name => 'C', :port => 'A')
0
       end
0
 
0
       it "should find by conditions" do
0
@@ -227,7 +227,7 @@ if ADAPTER
0
 
0
       it "should find by conditions passed in as hash" do
0
         repository(ADAPTER) do
0
- QuerySpec::SailBoat.create!(:name => "couldbe@email.com", :port => 'wee')
0
+ QuerySpec::SailBoat.create(:name => "couldbe@email.com", :port => 'wee')
0
 
0
           find = QuerySpec::SailBoat.first(:name => 'couldbe@email.com')
0
           find.name.should == 'couldbe@email.com'
0
@@ -287,17 +287,17 @@ if ADAPTER
0
       before do
0
         [ QuerySpec::SailBoat, QuerySpec::Permission ].each { |m| m.auto_migrate! }
0
 
0
- QuerySpec::SailBoat.create!(:id => 1, :name => "Fantasy I", :port => "Cape Town", :captain => 'Joe')
0
- QuerySpec::SailBoat.create!(:id => 2, :name => "Royal Flush II", :port => "Cape Town", :captain => 'James')
0
- QuerySpec::SailBoat.create!(:id => 3, :name => "Infringer III", :port => "Cape Town", :captain => 'Jason')
0
+ QuerySpec::SailBoat.create(:id => 1, :name => "Fantasy I", :port => "Cape Town", :captain => 'Joe')
0
+ QuerySpec::SailBoat.create(:id => 2, :name => "Royal Flush II", :port => "Cape Town", :captain => 'James')
0
+ QuerySpec::SailBoat.create(:id => 3, :name => "Infringer III", :port => "Cape Town", :captain => 'Jason')
0
 
0
         #User 1 permission -- read boat 1 & 2
0
- QuerySpec::Permission.create!(:id => 1, :user_id => 1, :resource_id => 1, :resource_type => 'SailBoat', :token => 'READ')
0
- QuerySpec::Permission.create!(:id => 2, :user_id => 1, :resource_id => 2, :resource_type => 'SailBoat', :token => 'READ')
0
+ QuerySpec::Permission.create(:id => 1, :user_id => 1, :resource_id => 1, :resource_type => 'SailBoat', :token => 'READ')
0
+ QuerySpec::Permission.create(:id => 2, :user_id => 1, :resource_id => 2, :resource_type => 'SailBoat', :token => 'READ')
0
 
0
         #User 2 permission -- read boat 2 & 3
0
- QuerySpec::Permission.create!(:id => 3, :user_id => 2, :resource_id => 2, :resource_type => 'SailBoat', :token => 'READ')
0
- QuerySpec::Permission.create!(:id => 4, :user_id => 2, :resource_id => 3, :resource_type => 'SailBoat', :token => 'READ')
0
+ QuerySpec::Permission.create(:id => 3, :user_id => 2, :resource_id => 2, :resource_type => 'SailBoat', :token => 'READ')
0
+ QuerySpec::Permission.create(:id => 4, :user_id => 2, :resource_id => 3, :resource_type => 'SailBoat', :token => 'READ')
0
       end
0
 
0
       it 'should accept a DM::Query as a value of a condition' do
...
231
232
233
234
 
235
236
237
238
239
240
 
241
242
243
...
348
349
350
351
352
353
354
355
356
357
358
 
 
 
 
 
 
 
 
359
360
361
...
231
232
233
 
234
235
236
237
238
239
 
240
241
242
243
...
348
349
350
 
 
 
 
 
 
 
 
351
352
353
354
355
356
357
358
359
360
361
0
@@ -231,13 +231,13 @@ if ADAPTER
0
 
0
     it "should be able to overwrite Resource#to_s" do
0
       repository(ADAPTER) do
0
- ted = FortunePig.create!(:name => "Ted")
0
+ ted = FortunePig.create(:name => "Ted")
0
         FortunePig.get!(ted.id).to_s.should == 'Ted'
0
       end
0
     end
0
 
0
     it "should be able to destroy objects" do
0
- apple = Apple.create!(:color => 'Green')
0
+ apple = Apple.create(:color => 'Green')
0
       lambda do
0
         apple.destroy.should be_true
0
       end.should_not raise_error
0
@@ -348,14 +348,14 @@ if ADAPTER
0
         Geek.auto_migrate!(ADAPTER)
0
 
0
         repository(ADAPTER) do
0
- Male.create!(:name => 'John Dorian')
0
- Bully.create!(:name => 'Bob', :iq => 69)
0
- Geek.create!(:name => 'Steve', :awkward => false, :iq => 132)
0
- Geek.create!(:name => 'Bill', :iq => 150)
0
- Bully.create!(:name => 'Johnson')
0
- Mugger.create!(:name => 'Frank')
0
- Maniac.create!(:name => 'William')
0
- Psycho.create!(:name => 'Norman')
0
+ Male.create(:name => 'John Dorian')
0
+ Bully.create(:name => 'Bob', :iq => 69)
0
+ Geek.create(:name => 'Steve', :awkward => false, :iq => 132)
0
+ Geek.create(:name => 'Bill', :iq => 150)
0
+ Bully.create(:name => 'Johnson')
0
+ Mugger.create(:name => 'Frank')
0
+ Maniac.create(:name => 'William')
0
+ Psycho.create(:name => 'Norman')
0
         end
0
 
0
         Flanimal.auto_migrate!(ADAPTER)
...
32
33
34
35
 
36
37
38
...
45
46
47
48
 
49
50
51
...
60
61
62
63
 
64
65
66
...
32
33
34
 
35
36
37
38
...
45
46
47
 
48
49
50
51
...
60
61
62
 
63
64
65
66
0
@@ -32,7 +32,7 @@ if ADAPTERS.any?
0
     it "should commit changes to all involved adapters on a two phase commit" do
0
       DataMapper::Transaction.new(*@repositories) do
0
         ADAPTERS.each do |name|
0
- repository(name) { Sputnik.create!(:name => 'hepp') }
0
+ repository(name) { Sputnik.create(:name => 'hepp') }
0
         end
0
       end
0
 
0
@@ -45,7 +45,7 @@ if ADAPTERS.any?
0
       lambda do
0
         DataMapper::Transaction.new(*@repositories) do
0
           ADAPTERS.each do |name|
0
- repository(name) { Sputnik.create!(:name => 'hepp') }
0
+ repository(name) { Sputnik.create(:name => 'hepp') }
0
           end
0
           raise "plur"
0
         end
0
@@ -60,7 +60,7 @@ if ADAPTERS.any?
0
       lambda do
0
         DataMapper::Transaction.new(*@repositories) do |transaction|
0
           ADAPTERS.each do |name|
0
- repository(name) { Sputnik.create!(:name => 'hepp') }
0
+ repository(name) { Sputnik.create(:name => 'hepp') }
0
           end
0
 
0
           transaction.primitive_for(@repositories.last.adapter).should_receive(:prepare).and_throw(Exception.new("I am the famous test exception"))
...
291
292
293
294
 
295
296
297
...
291
292
293
 
294
295
296
297
0
@@ -291,7 +291,7 @@ describe "DataMapper::Resource" do
0
   end
0
 
0
   it "should return an instance of the created object" do
0
- Planet.create!(:name => 'Venus', :age => 1_000_000, :id => 42).should be_a_kind_of(Planet)
0
+ Planet.create(:name => 'Venus', :age => 1_000_000, :id => 42).should be_a_kind_of(Planet)
0
   end
0
 
0
   it 'should provide persistance methods' do

Comments

    No one has commented yet.