poro_plus 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- poro_plus (1.0.1)
4
+ poro_plus (1.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module PoroPlus
2
- VERSION='1.0.1'
2
+ VERSION='1.0.2'
3
3
  end
@@ -18,16 +18,41 @@ describe PoroPlus do
18
18
  describe '#to_hash' do
19
19
 
20
20
  it 'serializes its instance variables' do
21
- thing = Thing.new(:foo => 1, :bar => 2)
21
+ thing = Thing.new(foo: 1, bar: 2)
22
22
  thing.to_hash[:foo].should == 1
23
23
  thing.to_hash[:bar].should == 2
24
24
  end
25
25
 
26
- it 'skips nil-value instance variables if so configured' do
27
- thing = Thing.new(:foo => 1, :bar => nil)
26
+ it 'nil-values are not skipped normally' do
27
+ thing = Thing.new(foo: 1, bar: nil)
28
+ thing.to_hash[:foo].should == 1
29
+ thing.to_hash[:bar].should be_nil
30
+ end
31
+
32
+ it 'skips nil-value instance variables if so configured with skip_nils flag' do
33
+ thing = Thing.new(foo: 1, bar: nil)
28
34
  thing.to_hash(:skip_nils => true).keys.include?(:bar).should be_false
29
35
  end
30
36
 
31
37
  end
38
+
39
+ describe '#to_json' do
40
+ it "converts its instance variables to json string" do
41
+ thing = Thing.new(foo: 1, bar: 2)
42
+ thing.to_json.should == "{\"foo\":1,\"bar\":2}"
43
+ end
44
+
45
+ it "converts nils to null" do
46
+ thing = Thing.new(foo: 1, bar: nil)
47
+ thing.to_json.should == "{\"foo\":1,\"bar\":null}"
48
+ end
49
+
50
+ it 'skips nil-value instance variables if so configured with skip_nils flag' do
51
+ thing = Thing.new(foo: 1, bar: nil)
52
+ thing.to_json(:skip_nils => true).should == "{\"foo\":1}"
53
+ end
54
+
55
+ end
56
+
57
+ end
32
58
 
33
- end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poro_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-03 00:00:00.000000000 Z
12
+ date: 2013-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -93,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  segments:
95
95
  - 0
96
- hash: 4604261282178270353
96
+ hash: -2746130522085779156
97
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  none: false
99
99
  requirements:
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  segments:
104
104
  - 0
105
- hash: 4604261282178270353
105
+ hash: -2746130522085779156
106
106
  requirements: []
107
107
  rubyforge_project:
108
108
  rubygems_version: 1.8.24