restful_resource 0.8.11 → 0.8.12
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 +4 -4
- data/lib/restful_resource/open_object.rb +12 -0
- data/lib/restful_resource/version.rb +1 -1
- data/spec/restful_resource/open_object_spec.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eed783eddea74a4d5c4b15dcaf9d12ed450d8957
|
4
|
+
data.tar.gz: 2de3afb79d0a6883a224f23f42b4801ab0ab2a8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f537e3a7bc25bc255aa5b7b6fafff90651a592c7252f80452fbbafccd5a24a863808a372f5743d93cb657538d5563584f1fb62b6e0b65e11b8f84027d2e912f0
|
7
|
+
data.tar.gz: 241d7d7669cccd17480faf00e5c0fb6c88a678b5b8a886d62b1c45457308294d4a8f29e906b903b77b1efe5e5aa121154e93e1b43984cce99e20e051d8a55ec1
|
@@ -19,5 +19,17 @@ module RestfulResource
|
|
19
19
|
def as_json(options=nil)
|
20
20
|
@inner_object.send(:table).as_json(options)
|
21
21
|
end
|
22
|
+
|
23
|
+
def ==(other)
|
24
|
+
@inner_object == other.instance_variable_get(:@inner_object)
|
25
|
+
end
|
26
|
+
|
27
|
+
def eql?(other)
|
28
|
+
@inner_object.eql?(other.instance_variable_get(:@inner_object))
|
29
|
+
end
|
30
|
+
|
31
|
+
def equal?(other)
|
32
|
+
@inner_object.equal?(other.instance_variable_get(:@inner_object))
|
33
|
+
end
|
22
34
|
end
|
23
35
|
end
|
@@ -13,4 +13,18 @@ describe RestfulResource::OpenObject do
|
|
13
13
|
|
14
14
|
expect { object.age }.to raise_error(NoMethodError)
|
15
15
|
end
|
16
|
+
|
17
|
+
it "should implement equality operators correctly" do
|
18
|
+
a = RestfulResource::OpenObject.new({name: 'Joe', age: 13})
|
19
|
+
b = RestfulResource::OpenObject.new({name: 'Joe', age: 13})
|
20
|
+
c = RestfulResource::OpenObject.new({name: 'Mike', age: 13})
|
21
|
+
|
22
|
+
expect(a == b).to eq true
|
23
|
+
expect(a.eql?(b)).to eq true
|
24
|
+
expect(a.equal?(b)).to eq false
|
25
|
+
|
26
|
+
expect(a == c).to eq false
|
27
|
+
expect(a.eql?(c)).to eq false
|
28
|
+
expect(a.equal?(c)).to eq false
|
29
|
+
end
|
16
30
|
end
|