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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b02d56671c1ac0e5d4c4a8a4ef3f1230e6a9c95d
4
- data.tar.gz: cc4f574c4a2144d228ae9c20f94740bbd56d0aab
3
+ metadata.gz: d68835af39eb4bd0fe2cf19186ac7ebc6a914e73
4
+ data.tar.gz: 312335d0591602ba607acafe86b365c12ef8c9c5
5
5
  SHA512:
6
- metadata.gz: 92fbdfc68499e85a69999ab153dc949515403e639c9fe042c09e84126f13b23b82517b2dc1c0a20d7b67011c921f8bd114821afbbc791e4e15d40939cd7a24b1
7
- data.tar.gz: 104430999272da34e5b7474cee5c1158152a98ebaf18f5d1b4843f237c9dec48a901c7af724ded42f62d30657ee58b77dd0ed2e431851aa4422d8ec846575026
6
+ metadata.gz: 328972652b7aad29e9abcd4351228193931637d8ffd2106715562288bebb434296c3bb3b30a90553ae6ec9d854e201075ab8ec56b1814d94b196b96ccd17f3a7
7
+ data.tar.gz: 2205de516c671dc357a3dd515a9b87f4e67d20512945105ff8095a0d5ceaa2058e4482223f64f0423e8263fb4ef58af17359acf7159b1fa05f1f2679d2948c73
@@ -1,3 +1,3 @@
1
1
  module SknUtils
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
data/lib/skn_utils.rb CHANGED
@@ -4,7 +4,6 @@ require 'skn_utils/nested_result_base'
4
4
  require 'skn_utils/generic_bean'
5
5
  require 'skn_utils/page_controls'
6
6
  require 'skn_utils/result_bean'
7
- require 'yaml'
8
7
 
9
8
  module SknUtils
10
9
 
@@ -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.attributes).to be_a(Hash)
55
- expect(object.attributes[:one]).to be_eql("one")
56
- expect(object.attributes[:three]).to be_a(Hash)
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.attributes).to be_a(Hash)
85
- expect(object.attributes[:one]).to be_eql("one")
86
- expect(object.attributes[:three]).to be_a(Hash)
87
- expect(object.attributes[:six].last[:six][:eight]).to eql('eight')
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 useage." do
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
@@ -2,6 +2,7 @@ ENV['RAILS_ENV'] ||= 'test'
2
2
 
3
3
  require 'skn_utils'
4
4
  require 'rspec'
5
+ require 'yaml'
5
6
 
6
7
  # Shared Examples and Support Routines
7
8
  Dir["./spec/support/**/*.rb"].sort.each { |f| require f}
@@ -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 "#attributes method excludes internal attributes unless overridden." do
42
- expect(@obj.attributes[:skn_enabled_depth]).to be_nil
43
- expect(@obj.attributes(true)[:skn_enabled_depth]).to be_nil
44
- expect(@obj.attributes(false)[:skn_enabled_depth]).to eql @obj.depth_level
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 "#attributes method returns a hash of all attributes and their values." do
39
- expect(@obj.attributes).to be_a(Hash)
40
- expect(@obj.attributes[:one]).to eql("one")
41
- expect(@obj.attributes[:three]).to be_a(Hash)
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.attributes[:skn_enabled_depth]).to be_nil
45
- expect(@obj.attributes(true)[:skn_enabled_depth]).to be_nil
46
- expect(@obj.attributes(false)[:skn_enabled_depth]).to eql @obj.depth_level
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.attributes).to be_a(Hash)
52
- expect(@obj.attributes[:one]).to be_eql("one")
53
- expect(@obj.attributes[:three]).to be_a(Hash)
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.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.8
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: