skn_utils 2.0.6 → 3.0.0

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.
@@ -1,60 +0,0 @@
1
- ##
2
- # <root>/spec/support/shared_example_ruby_pojo.rb
3
- #
4
- # refs: result_bean
5
- #
6
-
7
- RSpec.shared_examples "ruby pojo" do
8
- it "provides getters" do
9
- expect(@obj.one).to eql("one")
10
- expect(@obj.two).to eql("two")
11
- end
12
- it "provides setters" do
13
- @obj.one = "1"
14
- @obj.two = "2"
15
- expect(@obj.two).to eql("2")
16
- expect(@obj.one).to eql("1")
17
- end
18
- it "#clear_attribute sets given attribute to nil." do
19
- expect(@obj.two).to eql("two")
20
- expect(@obj.clear_two).to be_nil
21
- end
22
- it "#attribute? returns true or false based on true presence and non-blank contents of attribute." do
23
- expect(@obj.two?).to be true
24
- @obj.two = false
25
- expect(@obj.two?).to be true
26
- @obj.clear_two
27
- expect(@obj.two?).to be false
28
- expect(@obj.three?).to be true
29
- @obj.clear_three
30
- expect(@obj.three?).to be false
31
- end
32
- it "#attribute? returns false when attribute is not defined or unknown" do
33
- expect(@obj.address?).to be false
34
- end
35
- it "raises an 'NoMethodError' error when attribute that does not exist is accessed " do
36
- expect { @obj.address }.to raise_error NoMethodError
37
- end
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
- end
43
- it "#attributes method excludes internal attributes unless overridden." do
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
- end
48
-
49
- context "transformations are enabled with " do
50
- it "#attributes method returns a hash of all attributes and their values." do
51
- expect(@obj.to_hash).to be_a(Hash)
52
- expect(@obj.to_h).to be_a(Hash)
53
- expect(@obj.to_hash[:one]).to be_eql("one")
54
- expect(@obj.to_hash[:three]).to be_a(Hash)
55
- end
56
- it "#to_hash method returns a serialized version of this object." do
57
- expect(@obj.to_hash).to be_a(Hash)
58
- end
59
- end
60
- end