arrest 0.0.63 → 0.0.64

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,6 +14,12 @@ module Arrest
14
14
  define_filters
15
15
  end
16
16
 
17
+
18
+ def build(attributes = {})
19
+ resolved_class.new(@context, attributes)
20
+ end
21
+
22
+
17
23
  def method_missing(*args, &block)
18
24
  collection.send(*args, &block)
19
25
  end
@@ -1,3 +1,3 @@
1
1
  module Arrest
2
- VERSION = "0.0.63"
2
+ VERSION = "0.0.64"
3
3
  end
@@ -93,18 +93,5 @@ class HasAttributesTest < Test::Unit::TestCase
93
93
  assert !ih.got_me_ids_changed?
94
94
  assert !ih.changed?
95
95
  end
96
-
97
- def test_dirty_with_reload
98
- Arrest::Source.source = nil
99
- Arrest::Source.skip_validations = false
100
- @scope = Arrest::ScopedRoot.new
101
-
102
- ih = @scope.ItHasResource.new({:name => "Bla", :got_me_ids => ["BistDuEinRuede?"]})
103
- ih.save
104
-
105
- ih.reload
106
- assert_equal "Bla", ih.name
107
- assert_equal ["BistDuEinRuede?"], ih.got_me_ids
108
- end
109
96
  end
110
97
 
data/test/unit.rb CHANGED
@@ -361,32 +361,6 @@ class FirstTest < Test::Unit::TestCase
361
361
  assert_equal "Foo1", v1_reloaded.zoos.first.name
362
362
  end
363
363
 
364
- def test_has_many_with_reload
365
- @scope.Zoo.new(:name => "Foo1").save
366
- @scope.Zoo.new(:name => "Foo2").save
367
- assert_equal 2, @scope.Zoo.all.length
368
- all_zoo_ids = @scope.Zoo.all.map(&:id)
369
- v1 = @scope.ZooOwner.new({:name => "Foo", :zoo_ids => all_zoo_ids})
370
- v1.save
371
-
372
- zoo_id = @scope.Zoo.all.first.id
373
- v2 = @scope.ZooOwner.all.first
374
- v2.zoo_ids = [zoo_id]
375
- v2.save
376
-
377
- v1.reload
378
- assert_equal 1, v1.zoo_ids.length
379
- assert_equal 1, v1.zoos.length
380
- assert_equal zoo_id, v1.zoos.first.id
381
- end
382
-
383
- def test_build
384
- v1 = @scope.ZooOwner.new({:name => "Foo"})
385
- v1.save
386
-
387
- zoo = v1.zoos.build
388
- assert_equal v1.id, zoo.zoo_owner_id
389
- end
390
364
 
391
365
  def test_scope_has_many
392
366
  z1 = @scope.Zoo.new(:name => "Foo1", :open => true)
@@ -500,83 +474,6 @@ class FirstTest < Test::Unit::TestCase
500
474
  assert_equal 3, Arrest::Source.source.node_count
501
475
  end
502
476
 
503
- def test_has_many_matrix_in_mem_source
504
- f1 = @scope.Foo.new()
505
- f1.save
506
- f2 = @scope.Foo.new()
507
- f2.save
508
- f3 = @scope.Foo.new()
509
- f3.save
510
-
511
- b1 = @scope.Bar.new({:foo_ids => [f1.id, f2.id], :foo_id => f3.id})
512
- b1.save
513
-
514
- assert_equal 2, b1.foos.length
515
-
516
- b2 = @scope.Bar.new({:foo_ids => [f2.id, f3.id], :foo_id =>f1.id})
517
- b2.save
518
-
519
- f1.delete
520
-
521
- b1_rel = @scope.Bar.find(b1.id)
522
- assert_equal 1, b1_rel.foos.length
523
- assert_equal f2.id, b1_rel.foos.first.id
524
-
525
-
526
- f2.bar_ids=[b1.id]
527
- f2.other_bar_ids=[b2.id]
528
- f2.save
529
- f2_rel = @scope.Foo.find(f2.id)
530
- assert_equal 1, f2_rel.bars.length
531
- assert_equal 1, f2_rel.other_bars.length
532
-
533
- b2.delete
534
-
535
- f2_rel = @scope.Foo.find(f2.id)
536
- assert_equal 1, f2_rel.bars.length
537
- assert_equal 0, f2_rel.other_bars.length
538
- assert_equal b1.id, f2_rel.bars.first.id
539
-
540
- end
541
-
542
- def test_has_many_with_belongs_to
543
- f1 = @scope.Foo.new()
544
- f1.save
545
- f2 = @scope.Foo.new()
546
- f2.save
547
- f3 = @scope.Foo.new()
548
- f3.save
549
-
550
- b1 = @scope.Bar.new({:other_foo_id => f1.id, :foo_id => f3.id})
551
- b1.save
552
- b2 = @scope.Bar.new({:other_foo_id => f2.id, :foo_id => f1.id})
553
- b2.save
554
-
555
- f1_rel = @scope.Foo.find(f1.id)
556
- f2_rel = @scope.Foo.find(f2.id)
557
- f3_rel = @scope.Foo.find(f3.id)
558
-
559
- assert_equal 1, f1_rel.bars.length
560
- assert_equal b1.id, f1_rel.other_bars.first.id
561
- assert_equal b1.id, f3_rel.bars.first.id
562
-
563
- assert_equal b2.id, f1_rel.bars.first.id
564
- assert_equal b2.id, f2_rel.other_bars.first.id
565
-
566
- #test update
567
- b1.foo_id = f2.id
568
- b1.save
569
-
570
-
571
- f3_rel = @scope.Foo.find(f3.id)
572
- assert f3_rel.bars.empty?
573
- f2_rel = @scope.Foo.find(f2.id)
574
- assert_equal b1.id, f2_rel.bars.first.id
575
-
576
- b1.delete
577
- f1_rel = @scope.Foo.find(f1.id)
578
- assert f1_rel.other_bars.empty?
579
- end
580
477
 
581
478
  def test_equality_non_persistent
582
479
  zoo1 = @scope.Zoo.new(:name => 'zoo1')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.63
4
+ version: 0.0.64
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-12 00:00:00.000000000Z
12
+ date: 2012-06-13 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &20728140 !ruby/object:Gem::Requirement
16
+ requirement: &25854200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *20728140
24
+ version_requirements: *25854200
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: faraday
27
- requirement: &20727640 !ruby/object:Gem::Requirement
27
+ requirement: &25853700 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.7.5
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *20727640
35
+ version_requirements: *25853700
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activemodel
38
- requirement: &20727140 !ruby/object:Gem::Requirement
38
+ requirement: &25853200 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '3'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *20727140
46
+ version_requirements: *25853200
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &20726680 !ruby/object:Gem::Requirement
49
+ requirement: &25852740 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *20726680
57
+ version_requirements: *25852740
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &20726300 !ruby/object:Gem::Requirement
60
+ requirement: &25852360 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *20726300
68
+ version_requirements: *25852360
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rdoc
71
- requirement: &20725840 !ruby/object:Gem::Requirement
71
+ requirement: &25851900 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *20725840
79
+ version_requirements: *25851900
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &20725340 !ruby/object:Gem::Requirement
82
+ requirement: &25851400 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '2'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *20725340
90
+ version_requirements: *25851400
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rr
93
- requirement: &20724920 !ruby/object:Gem::Requirement
93
+ requirement: &25871460 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *20724920
101
+ version_requirements: *25871460
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: simplecov
104
- requirement: &20724460 !ruby/object:Gem::Requirement
104
+ requirement: &25871000 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *20724460
112
+ version_requirements: *25871000
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rack
115
- requirement: &20724040 !ruby/object:Gem::Requirement
115
+ requirement: &25870580 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *20724040
123
+ version_requirements: *25870580
124
124
  description: Consume a rest API in a AR like fashion
125
125
  email:
126
126
  - axel.tetzlaff@fortytools.com