blockhead 0.0.6 → 0.0.7

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: 88d989362f1384c7e3f8474a58073eec6007415e
4
- data.tar.gz: bb4eed08458054d201b7582f0a48b13c7c71dc02
3
+ metadata.gz: 53eb88ab447f317759654458a6a549a29994d9de
4
+ data.tar.gz: b4caaf07cfd3f966e6f09cfdbe84b9445fefc991
5
5
  SHA512:
6
- metadata.gz: 83fd44e578527ebcdeec6045e7a1ae6e65cf4ad31ec0c91f471b98ce0b5a777ba4e470853beb1f7ed168365fd902adddd6c2241d8fa24853dda034a90dc1c8ca
7
- data.tar.gz: 1485bc561d5584f5e6bec5a98fa12540dbd11a528cd6a82fed2882d4169133bf19383b7d7e523081afcc04f4bceb5e0897bb4110b97769a258fddc940270e786
6
+ metadata.gz: 3728ce96b5187c29a7109dd8b383ab0e872ef281d1448917be8063548fe27c44aa329210e80dedd9993bbe9286ca39629ebd07cc9d0d4a316f33a655a25fba69
7
+ data.tar.gz: b114e8bd9b8aa04598bac284f8b942574fd48eb32ada9509ff9cf64c9a63001bab7656a0313875b7abd20c6be0d655244f12be90d9aaead87e1bf1f16731212b
@@ -22,9 +22,13 @@ module Blockhead
22
22
  def _call(name)
23
23
  if @arg == :wrap
24
24
  object
25
- elsif object.respond_to?(name)
25
+ elsif valid_message?(name)
26
26
  object.send name
27
27
  end
28
28
  end
29
+
30
+ def valid_message?(name)
31
+ object.respond_to?(name) && !object.nil? # nil responds to :id in Rails.
32
+ end
29
33
  end
30
34
  end
@@ -1,3 +1,3 @@
1
1
  module Blockhead
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
@@ -50,6 +50,16 @@ describe Blockhead::Schema, '::define' do
50
50
  expect(schema.marshal).to eq response
51
51
  end
52
52
 
53
+ it 'handles :id when nil responds to id (Rails)' do
54
+ allow(nil).to receive(:respond_to?).with(:id).and_return(true)
55
+
56
+ schema = Blockhead::Schema.define nil do
57
+ id
58
+ end
59
+
60
+ expect(schema.marshal).to eq(id: nil)
61
+ end
62
+
53
63
  it 'handles wrappers' do
54
64
  schema = schema_with do
55
65
  surprise :wrap do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blockhead
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Franco
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-15 00:00:00.000000000 Z
11
+ date: 2014-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler