skn_utils 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/skn_utils/version.rb +1 -1
- data/lib/skn_utils.rb +0 -1
- data/spec/lib/skn_utils/generic_bean_spec.rb +3 -3
- data/spec/lib/skn_utils/page_controls_spec.rb +4 -4
- data/spec/lib/skn_utils/result_bean_spec.rb +5 -2
- data/spec/spec_helper.rb +1 -0
- data/spec/support/shared_example_marshalable_ruby_pojo.rb +4 -4
- data/spec/support/shared_example_ruby_pojo.rb +10 -10
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d68835af39eb4bd0fe2cf19186ac7ebc6a914e73
|
4
|
+
data.tar.gz: 312335d0591602ba607acafe86b365c12ef8c9c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 328972652b7aad29e9abcd4351228193931637d8ffd2106715562288bebb434296c3bb3b30a90553ae6ec9d854e201075ab8ec56b1814d94b196b96ccd17f3a7
|
7
|
+
data.tar.gz: 2205de516c671dc357a3dd515a9b87f4e67d20512945105ff8095a0d5ceaa2058e4482223f64f0423e8263fb4ef58af17359acf7159b1fa05f1f2679d2948c73
|
data/lib/skn_utils/version.rb
CHANGED
data/lib/skn_utils.rb
CHANGED
@@ -51,9 +51,9 @@ RSpec.describe SknUtils::GenericBean, "Generic Marshal'able Bean class " do
|
|
51
51
|
expect(object.three.five).to eq(5)
|
52
52
|
end
|
53
53
|
it "#attributes method returns a hash of all attributes and their values." do
|
54
|
-
expect(object.
|
55
|
-
expect(object.
|
56
|
-
expect(object.
|
54
|
+
expect(object.to_hash).to be_a(Hash)
|
55
|
+
expect(object.to_hash[:one]).to be_eql("one")
|
56
|
+
expect(object.to_hash[:three]).to be_a(Hash)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -81,10 +81,10 @@ RSpec.describe SknUtils::PageControls, "PageControls Marshal'able Bean class " d
|
|
81
81
|
expect(object.one_array[0]).to be_a(SknUtils::PageControls)
|
82
82
|
end
|
83
83
|
it "#attributes method returns a hash of all attributes and their values." do
|
84
|
-
expect(object.
|
85
|
-
expect(object.
|
86
|
-
expect(object.
|
87
|
-
expect(object.
|
84
|
+
expect(object.to_hash).to be_a(Hash)
|
85
|
+
expect(object.to_hash[:one]).to be_eql("one")
|
86
|
+
expect(object.to_hash[:three]).to be_a(Hash)
|
87
|
+
expect(object.to_hash[:six].last[:six][:eight]).to eql('eight')
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -2,13 +2,16 @@
|
|
2
2
|
# spec/lib/skn_utils/result_bean_spec.rb
|
3
3
|
#
|
4
4
|
|
5
|
-
RSpec.describe SknUtils::ResultBean, "Result Bean class - Basic
|
5
|
+
RSpec.describe SknUtils::ResultBean, "Result Bean class - Basic usage." do
|
6
6
|
let(:object) {
|
7
7
|
SknUtils::ResultBean.new({one: "one",
|
8
8
|
two: "two",
|
9
9
|
three: {four: 4, five: 5, six: {seven: 7, eight: "eight" }},
|
10
10
|
four: {any_key: "any value"},
|
11
|
-
five: []
|
11
|
+
five: [],
|
12
|
+
six: [{four: 4, five: 5, six: {seven: 7, eight: "eight" }},
|
13
|
+
{four: 4, five: 5, six: {nine: 9, ten: "ten" }}
|
14
|
+
]
|
12
15
|
})
|
13
16
|
}
|
14
17
|
|
data/spec/spec_helper.rb
CHANGED
@@ -38,10 +38,10 @@ RSpec.shared_examples "marshalable ruby pojo" do
|
|
38
38
|
it "raises an 'NoMethodError' error when attribute does not exist" do
|
39
39
|
expect { @obj.address }.to raise_error NoMethodError
|
40
40
|
end
|
41
|
-
it "#
|
42
|
-
expect(@obj.
|
43
|
-
expect(@obj.
|
44
|
-
expect(@obj.
|
41
|
+
it "#to_hash method excludes internal attributes unless overridden." do
|
42
|
+
expect(@obj.to_hash[:skn_enabled_depth]).to be_nil
|
43
|
+
expect(@obj.to_hash(false)[:skn_enabled_depth]).to be_nil
|
44
|
+
expect(@obj.to_hash(true)[:skn_enabled_depth]).to eql @obj.depth_level
|
45
45
|
end
|
46
46
|
context "transformations are enabled with " do
|
47
47
|
it "#to_hash method returns a serialized version of this object." do
|
@@ -35,22 +35,22 @@ RSpec.shared_examples "ruby pojo" do
|
|
35
35
|
it "raises an 'NoMethodError' error when attribute that does not exist is accessed " do
|
36
36
|
expect { @obj.address }.to raise_error NoMethodError
|
37
37
|
end
|
38
|
-
it "#
|
39
|
-
expect(@obj.
|
40
|
-
expect(@obj.
|
41
|
-
expect(@obj.
|
38
|
+
it "#to_hash method returns a hash of all attributes and their values." do
|
39
|
+
expect(@obj.to_hash).to be_a(Hash)
|
40
|
+
expect(@obj.to_hash[:one]).to eql("one")
|
41
|
+
expect(@obj.to_hash[:three]).to be_a(Hash)
|
42
42
|
end
|
43
43
|
it "#attributes method excludes internal attributes unless overridden." do
|
44
|
-
expect(@obj.
|
45
|
-
expect(@obj.
|
46
|
-
expect(@obj.
|
44
|
+
expect(@obj.to_hash[:skn_enabled_depth]).to be_nil
|
45
|
+
expect(@obj.to_hash(false)[:skn_enabled_depth]).to be_nil
|
46
|
+
expect(@obj.to_hash(true)[:skn_enabled_depth]).to eql @obj.depth_level
|
47
47
|
end
|
48
48
|
|
49
49
|
context "transformations are enabled with " do
|
50
50
|
it "#attributes method returns a hash of all attributes and their values." do
|
51
|
-
expect(@obj.
|
52
|
-
expect(@obj.
|
53
|
-
expect(@obj.
|
51
|
+
expect(@obj.to_hash).to be_a(Hash)
|
52
|
+
expect(@obj.to_hash[:one]).to be_eql("one")
|
53
|
+
expect(@obj.to_hash[:three]).to be_a(Hash)
|
54
54
|
end
|
55
55
|
it "#to_hash method returns a serialized version of this object." do
|
56
56
|
expect(@obj.to_hash).to be_a(Hash)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skn_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Scott Jr
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.4.
|
125
|
+
rubygems_version: 2.4.6
|
126
126
|
signing_key:
|
127
127
|
specification_version: 3
|
128
128
|
summary: Ruby convenience utilities, the first being a ResultBean. ResultBean is
|
@@ -137,3 +137,4 @@ test_files:
|
|
137
137
|
- spec/spec_helper.rb
|
138
138
|
- spec/support/shared_example_marshalable_ruby_pojo.rb
|
139
139
|
- spec/support/shared_example_ruby_pojo.rb
|
140
|
+
has_rdoc:
|