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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f78ca1c3460fdd0b52a6c398e2837a0bb6d750fa
4
- data.tar.gz: 5752105ecb4363cd8a681ea87008ed166c106018
3
+ metadata.gz: 50e4538f142042bcdbcc5c29e46b3a268b9fef04
4
+ data.tar.gz: 7aaf2a518c3d4c1653f1abba85f7e2edda56dd90
5
5
  SHA512:
6
- metadata.gz: 39c47fd2e35da1270a206c42785d8c7395f7402dc7c7f14064650970c3b9a1d2996b486c2fe92dc563911045b21484237764cb555bc0c8ed556d4e94db77af4e
7
- data.tar.gz: f5bd09ed0b9dadff3f20a1723a7142c02588888316239373cd593d90623e558bca94245bc0de27780c517fc2757a97c1dc39ff492115e2382d623730949a7fd0
6
+ metadata.gz: 5bed8237bc75b66a1b95189945e9e567efa83d335a4f18f8329052202a3851f32198617e7baa67a514a2e57190ce15a699f97f2726db3cf538c12d38581de7e9
7
+ data.tar.gz: 06aeb09d06e2596c604c8234381963838b69ea4e7594821cdc86324f9111c0479cb481533f746085ee74efc673f8bf4055bec9f2e7f18b4306bb79fda812f941
@@ -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
- @wrapper.assign_attributes message_or_attributes
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 `assign_attributes` on its wrapper object when a hash is given' do
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
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-05-27 00:00:00.000000000 Z
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
@@ -1,2 +0,0 @@
1
- import public "protip/messages/types.proto";
2
- import public "protip/messages/wrappers.proto";