object_attorney 2.8.0 → 2.8.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.
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
YjBiYjY2NTJjZDkxMzdhMDE4OGExNzM2NGE5NDMzYjVmZmYwYjg2OA==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
NjI5NDA4NGU4YjNkZTJjZTdjZWJkMDNiNjgwZmIxMmIwMzlkOGZlNQ==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
MzkxYmE0YTM3ZDdlZTJjZWQyMDQ3YThiZTE4MWNlZTM5NDg0MjhhOTllMjQ5
|
|
10
|
+
YmZlZmRkMGNiY2I3Y2EzN2FhYzEyZmQ0MzY0OWE3ODMwYzg3NmZmZjYxMDYz
|
|
11
|
+
MWRhNjk5ZDQ1NzczNWI4NWI1MTY5YWRmNzI0ODg2NjJlOGVmM2I=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
ZTA5YWQwMzBhZjU5ZmVlNDQ0MmUyMjRlYTVjZmEzOTJjODk4YmZlZDcyZmQw
|
|
14
|
+
MWZjYTk5MjQyNDk3OWFlZThmNGE3MjJlNjc0NjMyNmJiNDcwZTZhMWEzNTA3
|
|
15
|
+
NzM0ZmRiMTBhN2YwM2Y3N2YwM2IxMGY0ODBhMTkxMGVjODAxODA=
|
|
@@ -20,7 +20,11 @@ module ObjectAttorney
|
|
|
20
20
|
module ClassMethods
|
|
21
21
|
|
|
22
22
|
def exposed_getters
|
|
23
|
-
@exposed_getters
|
|
23
|
+
return @exposed_getters if defined?(@exposed_getters)
|
|
24
|
+
|
|
25
|
+
@exposed_getters = zuper_method(:exposed_getters)
|
|
26
|
+
|
|
27
|
+
@exposed_getters ||= represented_object_class.present? && represented_object_class.method_defined?(:id) ? [:id] : []
|
|
24
28
|
end
|
|
25
29
|
|
|
26
30
|
def add_exposed_getters(*getters)
|
|
@@ -14,8 +14,6 @@ shared_examples "a PostForm with delegated properties" do
|
|
|
14
14
|
post_form = described_class.new(params[:post])
|
|
15
15
|
|
|
16
16
|
post_form.save.should == true
|
|
17
|
-
described_class.exposed_getters.should == [:title, :user_id]
|
|
18
|
-
described_class.exposed_setters.should == [:title, :user_id]
|
|
19
17
|
|
|
20
18
|
Post.all.count.should == 1
|
|
21
19
|
post = Post.first
|
|
@@ -49,8 +47,6 @@ shared_examples "a PostForm with only delegated getters" do
|
|
|
49
47
|
post_form = described_class.new(params[:post], post)
|
|
50
48
|
|
|
51
49
|
post_form.save.should == true
|
|
52
|
-
described_class.exposed_getters.should == [:title, :user_id]
|
|
53
|
-
described_class.exposed_setters.should == []
|
|
54
50
|
|
|
55
51
|
Post.all.count.should == 1
|
|
56
52
|
post = Post.first
|
|
@@ -88,8 +84,6 @@ shared_examples "a PostForm with only delegated setters" do
|
|
|
88
84
|
post_form = described_class.new(params[:post], post)
|
|
89
85
|
|
|
90
86
|
post_form.save.should == true
|
|
91
|
-
described_class.exposed_getters.should == []
|
|
92
|
-
described_class.exposed_setters.should == [:title, :user_id]
|
|
93
87
|
|
|
94
88
|
Post.all.count.should == 1
|
|
95
89
|
post = Post.first
|
|
@@ -14,7 +14,7 @@ describe PostForm::GrandSon do
|
|
|
14
14
|
post_form = described_class.new(params[:post], post)
|
|
15
15
|
|
|
16
16
|
post_form.save.should == true
|
|
17
|
-
described_class.exposed_getters.should == [:title, :email, :author, :body, :date]
|
|
17
|
+
described_class.exposed_getters.should == [:id, :title, :email, :author, :body, :date]
|
|
18
18
|
described_class.exposed_setters.should == [:title, :user_id]
|
|
19
19
|
|
|
20
20
|
Post.all.count.should == 1
|
|
@@ -33,7 +33,7 @@ describe PostForm::GrandSon do
|
|
|
33
33
|
post_form.date.should == '20-10-2010'
|
|
34
34
|
post_form.respond_to?(:user_id).should == false
|
|
35
35
|
|
|
36
|
-
data = { title: "altered title", email: "test@gmail.com", author: "test", body: "post body", date: "20-10-2010" }
|
|
36
|
+
data = { id:1, title: "altered title", email: "test@gmail.com", author: "test", body: "post body", date: "20-10-2010" }
|
|
37
37
|
|
|
38
38
|
post_form.exposed_data.should == data
|
|
39
39
|
post_form.to_json.should == data.to_json
|