poro_plus 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/poro_plus/version.rb +1 -1
- data/spec/lib/poro_plus/poro_plus_spec.rb +29 -4
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/poro_plus/version.rb
CHANGED
@@ -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(:
|
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 '
|
27
|
-
thing = Thing.new(:
|
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.
|
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-
|
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:
|
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:
|
105
|
+
hash: -2746130522085779156
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
108
|
rubygems_version: 1.8.24
|