hal-interpretation 1.9.0 → 1.9.1

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: 5d0bb8bd69d4f918747724f90a4fa6099a8902a5
4
- data.tar.gz: a7b3dba7c022043f163e222f124867805f28d20d
3
+ metadata.gz: dcb105631be075dfd26ba7e8250c74e7ebe71b96
4
+ data.tar.gz: f64b9a1ad967f2ec3a27ad2870846af772e46c24
5
5
  SHA512:
6
- metadata.gz: 58cc7ed92a124e87edc19a071e109ff35de963a905849b11774c6e3772ba7a799131dbfd1a2872c2d9cc2d0b940e2a0bc5fbb2680f9a020596cf8c41c5b4ca50
7
- data.tar.gz: 0ac2e4aff92dd46c3eea872a36210938e33a7900d4f3be90e9d2a56689d4002c9ccd099d1e83306cfd8e1ba91bbab7ea4dd043033080a2e803ec61c578b65057
6
+ metadata.gz: 6dc1bccb18281d451c008fa1abdb30ce7af07a872a279322d5ef15041ab9292bdb8f3b12d4bcb4c88b8c04aeb962df281d1509d2089e470186842942546211c4
7
+ data.tar.gz: e59db9dbf4107c7e9fecfd84ed9b7b77614ecd0afb521947087c0842ef21cf2801acd1ec0bdf90f5900dd64f6a8b7d8297b6d499685939af0956e38124551f8a
@@ -37,7 +37,7 @@ module HalInterpretation
37
37
  context = opts.fetch(:context, self)
38
38
 
39
39
  raw_val = context.instance_exec from, &fetcher
40
- return [] unless raw_val
40
+ return [] if raw_val.nil?
41
41
 
42
42
  val = context.instance_exec raw_val, &value_coercion
43
43
 
@@ -1,3 +1,3 @@
1
1
  module HalInterpretation
2
- VERSION = "1.9.0"
2
+ VERSION = "1.9.1"
3
3
  end
@@ -72,6 +72,24 @@ describe HalInterpretation::Extractor do
72
72
  specify { expect(target.age).to eq 1 }
73
73
  end
74
74
 
75
+ context "boolean attr true" do
76
+ subject(:extractor) { described_class.new(attr: "likes_chocolate",
77
+ location: "/likesChocolate") }
78
+
79
+ before do extractor.extract(from: source, to: target) end
80
+
81
+ specify { expect(target.likes_chocolate).to eq true }
82
+ end
83
+
84
+ context "boolean attr false" do
85
+ subject(:extractor) { described_class.new(attr: "likes_anchovies",
86
+ location: "/likesAnchovies") }
87
+
88
+ before do extractor.extract(from: source, to: target) end
89
+
90
+ specify { expect(target.likes_anchovies).to eq false }
91
+ end
92
+
75
93
  context "missing attr" do
76
94
  subject(:extractor) { described_class.new(attr: "seq") }
77
95
 
@@ -81,11 +99,20 @@ describe HalInterpretation::Extractor do
81
99
  end
82
100
 
83
101
 
84
- let(:target) { Struct.new(:first_name, :bday, :parent, :seq, :age).new }
102
+ let(:target) { Struct.new(:first_name,
103
+ :bday,
104
+ :parent,
105
+ :seq,
106
+ :age,
107
+ :likes_chocolate,
108
+ :likes_anchovies).new }
109
+
85
110
  let(:source) { HalClient::Representation.new(parsed_json: {
86
111
  "age" => 1,
87
112
  "firstName" => "Alice",
88
113
  "bday" => "2013-10-10T12:13:14Z",
114
+ "likesChocolate" => true,
115
+ "likesAnchovies" => false,
89
116
  "_links" => {
90
117
  "up" => { "href" => "http://foo" }}}) }
91
118
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hal-interpretation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-07 00:00:00.000000000 Z
11
+ date: 2016-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hal-client