restpack_serializer 0.4.18 → 0.4.19

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: b5d4602dfd29b489ac3e1a2a1192625f5f599374
4
- data.tar.gz: 5d9a645df308d563842d2a0441ae432dc7b77575
3
+ metadata.gz: b1934e0aa0c85eb7848c1426beceb87429524339
4
+ data.tar.gz: 3777393caff790b957880a535ef3903511434534
5
5
  SHA512:
6
- metadata.gz: c71574252375b37bf0b2052a0c583d5eed1ce568682fe1a42ac767d253d4e5bdf38b66162d624d992d9b287f02fa157cf33322dd25408eadec50dbd6f84a5115
7
- data.tar.gz: 561c9c63d41976b5b77111dc5301b33aa9e017cb9fe3b177ded3dc7ad5024d00acd3f54f3a6fa6f23ec150d460e467bcba40bb39a2481f17fe0683346f6c10d4
6
+ metadata.gz: 6e5e801140067e5dad68a4714f901d08f211a5dffbd070c29a1492c968e317e27416ab9fd4647433ca06b856e41d45ad121f620679d6c11f2de2b2a4baef772f
7
+ data.tar.gz: cea188aef0a8675089deb643b7e0f8c8dee2cbcd5d6e750732ff872347463d1381571b6c5d17c642925cc14447c702f8e1967aa15703fad7f3aad6fe2b6f68e2
@@ -29,6 +29,7 @@ module RestPack
29
29
  class InvalidInclude < Exception; end
30
30
 
31
31
  def as_json(model, context = {})
32
+ return if model.nil?
32
33
  if model.kind_of?(Array)
33
34
  return model.map { |item| as_json(item, context) }
34
35
  end
@@ -1,5 +1,5 @@
1
1
  module RestPack
2
2
  module Serializer
3
- VERSION = '0.4.18'
3
+ VERSION = '0.4.19'
4
4
  end
5
5
  end
@@ -69,7 +69,7 @@ describe RestPack::Serializer do
69
69
  }
70
70
  end
71
71
 
72
- context "serializes an array" do
72
+ context "an array" do
73
73
  let(:people) { [person, person] }
74
74
  it "results in a serialized array" do
75
75
  serializer.as_json(people).should == [
@@ -85,6 +85,12 @@ describe RestPack::Serializer do
85
85
  end
86
86
  end
87
87
 
88
+ context "nil" do
89
+ it "results in nil" do
90
+ serializer.as_json(nil).should == nil
91
+ end
92
+ end
93
+
88
94
  context "with options" do
89
95
  it "excludes specified attributes" do
90
96
  serializer.as_json(person, { include_description?: false }).should == {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restpack_serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.18
4
+ version: 0.4.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Joyce