arrest 0.0.34 → 0.0.35
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/arrest/abstract_resource.rb +5 -0
- data/lib/arrest/attributes/has_attributes.rb +7 -5
- data/lib/arrest/version.rb +1 -1
- data/test/unit.rb +19 -0
- metadata +22 -31
@@ -88,11 +88,6 @@ module Arrest
|
|
88
88
|
self.save
|
89
89
|
end
|
90
90
|
|
91
|
-
def reload
|
92
|
-
hash = self.class.find(self.context, self.id).to_hash
|
93
|
-
self.attributes= hash
|
94
|
-
end
|
95
|
-
|
96
91
|
def load_from_stub
|
97
92
|
@load_blk.call
|
98
93
|
@stubbed = false
|
@@ -192,5 +187,12 @@ module Arrest
|
|
192
187
|
def stubbed?
|
193
188
|
@stubbed
|
194
189
|
end
|
190
|
+
|
191
|
+
protected
|
192
|
+
def internal_reload
|
193
|
+
hash = self.class.find(self.context, self.id).to_hash
|
194
|
+
self.attributes= hash
|
195
|
+
end
|
196
|
+
|
195
197
|
end
|
196
198
|
end
|
data/lib/arrest/version.rb
CHANGED
data/test/unit.rb
CHANGED
@@ -361,6 +361,25 @@ 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
|
+
|
364
383
|
def test_build
|
365
384
|
v1 = @scope.ZooOwner.new({:name => "Foo"})
|
366
385
|
v1.save
|
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.
|
4
|
+
version: 0.0.35
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-03-01 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
requirement: &
|
16
|
+
requirement: &17815000 !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: *
|
24
|
+
version_requirements: *17815000
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: faraday
|
27
|
-
requirement: &
|
27
|
+
requirement: &17814280 !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: *
|
35
|
+
version_requirements: *17814280
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: activemodel
|
38
|
-
requirement: &
|
38
|
+
requirement: &17813440 !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: *
|
46
|
+
version_requirements: *17813440
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &17812760 !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: *
|
57
|
+
version_requirements: *17812760
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rake
|
60
|
-
requirement: &
|
60
|
+
requirement: &17812180 !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: *
|
68
|
+
version_requirements: *17812180
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rdoc
|
71
|
-
requirement: &
|
71
|
+
requirement: &17811700 !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: *
|
79
|
+
version_requirements: *17811700
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rspec
|
82
|
-
requirement: &
|
82
|
+
requirement: &17811180 !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: *
|
90
|
+
version_requirements: *17811180
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rr
|
93
|
-
requirement: &
|
93
|
+
requirement: &17810700 !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: *
|
101
|
+
version_requirements: *17810700
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: simplecov
|
104
|
-
requirement: &
|
104
|
+
requirement: &17810220 !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: *
|
112
|
+
version_requirements: *17810220
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: rack
|
115
|
-
requirement: &
|
115
|
+
requirement: &17809620 !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: *
|
123
|
+
version_requirements: *17809620
|
124
124
|
description: Consume a rest API in a AR like fashion
|
125
125
|
email:
|
126
126
|
- axel.tetzlaff@fortytools.com
|
@@ -194,13 +194,4 @@ rubygems_version: 1.8.10
|
|
194
194
|
signing_key:
|
195
195
|
specification_version: 3
|
196
196
|
summary: Another ruby rest client
|
197
|
-
test_files:
|
198
|
-
- spec/arrest_spec.rb
|
199
|
-
- spec/spec_helper.rb
|
200
|
-
- spec/support/models/user.rb
|
201
|
-
- test/context.rb
|
202
|
-
- test/has_attributed.rb
|
203
|
-
- test/models.rb
|
204
|
-
- test/nested_resource.rb
|
205
|
-
- test/unit.rb
|
206
|
-
- test/validations.rb
|
197
|
+
test_files: []
|