protip 0.10.4 → 0.10.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/protip/resource.rb +2 -1
- data/test/unit/protip/resource_test.rb +15 -1
- metadata +2 -3
- data/definitions/protip.proto +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50e4538f142042bcdbcc5c29e46b3a268b9fef04
|
4
|
+
data.tar.gz: 7aaf2a518c3d4c1653f1abba85f7e2edda56dd90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bed8237bc75b66a1b95189945e9e567efa83d335a4f18f8329052202a3851f32198617e7baa67a514a2e57190ce15a699f97f2726db3cf538c12d38581de7e9
|
7
|
+
data.tar.gz: 06aeb09d06e2596c604c8234381963838b69ea4e7594821cdc86324f9111c0479cb481533f746085ee74efc673f8bf4055bec9f2e7f18b4306bb79fda812f941
|
data/lib/protip/resource.rb
CHANGED
@@ -134,6 +134,7 @@ module Protip
|
|
134
134
|
|
135
135
|
def_delegator :@wrapper, :message
|
136
136
|
def_delegator :@wrapper, :as_json
|
137
|
+
def_delegator :@wrapper, :assign_attributes
|
137
138
|
end
|
138
139
|
module ClassMethods
|
139
140
|
|
@@ -236,7 +237,7 @@ module Protip
|
|
236
237
|
self.message = message_or_attributes
|
237
238
|
else
|
238
239
|
self.message = self.class.message.new
|
239
|
-
|
240
|
+
assign_attributes message_or_attributes
|
240
241
|
end
|
241
242
|
|
242
243
|
super()
|
@@ -309,7 +309,7 @@ module Protip::ResourceTest # Namespace for internal constants
|
|
309
309
|
assert_equal ResourceMessage.new(attrs), resource_class.new(attrs).message
|
310
310
|
end
|
311
311
|
|
312
|
-
it 'delegates to
|
312
|
+
it 'delegates to #assign_attributes on its wrapper object when a hash is given' do
|
313
313
|
attrs = {id: 3}
|
314
314
|
Protip::Wrapper.any_instance.expects(:assign_attributes).once.with({id: 3})
|
315
315
|
resource_class.new(attrs)
|
@@ -317,6 +317,20 @@ module Protip::ResourceTest # Namespace for internal constants
|
|
317
317
|
end
|
318
318
|
end
|
319
319
|
|
320
|
+
describe '#assign_attributes' do
|
321
|
+
before do
|
322
|
+
resource_class.class_eval do
|
323
|
+
resource actions: [], message: ResourceMessage
|
324
|
+
end
|
325
|
+
end
|
326
|
+
it 'delegates to #assign_attributes on its wrapper object' do
|
327
|
+
resource = resource_class.new
|
328
|
+
|
329
|
+
Protip::Wrapper.any_instance.expects(:assign_attributes).once.with(string: 'whodunnit').returns('boo')
|
330
|
+
assert_equal 'boo', resource.assign_attributes(string: 'whodunnit')
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
320
334
|
describe '#save' do
|
321
335
|
let :response do
|
322
336
|
ResourceMessage.new(string: 'pit', string2: 'bull', id: 200)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AngelList
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -142,7 +142,6 @@ executables: []
|
|
142
142
|
extensions: []
|
143
143
|
extra_rdoc_files: []
|
144
144
|
files:
|
145
|
-
- definitions/protip.proto
|
146
145
|
- definitions/protip/messages/array.proto
|
147
146
|
- definitions/protip/messages/errors.proto
|
148
147
|
- definitions/protip/messages/types.proto
|
data/definitions/protip.proto
DELETED