smart_properties 1.8.1 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smart_properties.rb +9 -1
- data/spec/inheritance_spec.rb +23 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9129f5a59082dea813606c2c71007a999765dec0
|
4
|
+
data.tar.gz: 580c42e4b0d7cc3c728a44374b2bbdbbd683b4cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22e0491c55f9f6aa08621bc2501f66e093aa005412ae647768907d4dcae2b9c730fcf542a3ef5ac8ff30bdb8ef83f7ad62e406d7b4eb72cee449ee65ada9c3ad
|
7
|
+
data.tar.gz: 0706e812564f577b0da0dd2fd1fcea21aaea5e19321832be0151fb9b21c1bf9ea9c14774b549e1a59ce9e7d3de4defe46e3ffa58835201a694624a0fc6c44c65
|
data/lib/smart_properties.rb
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
# :required => true
|
22
22
|
#
|
23
23
|
module SmartProperties
|
24
|
-
VERSION = "1.
|
24
|
+
VERSION = "1.9.0"
|
25
25
|
|
26
26
|
class Error < ::ArgumentError; end
|
27
27
|
class ConfigurationError < Error; end
|
@@ -202,6 +202,14 @@ module SmartProperties
|
|
202
202
|
collection_with_parent_collection.key?(name)
|
203
203
|
end
|
204
204
|
|
205
|
+
def keys
|
206
|
+
collection_with_parent_collection.keys
|
207
|
+
end
|
208
|
+
|
209
|
+
def values
|
210
|
+
collection_with_parent_collection.values
|
211
|
+
end
|
212
|
+
|
205
213
|
def each(&block)
|
206
214
|
collection_with_parent_collection.each(&block)
|
207
215
|
end
|
data/spec/inheritance_spec.rb
CHANGED
@@ -33,6 +33,16 @@ RSpec.describe SmartProperties, 'intheritance' do
|
|
33
33
|
context 'the section class' do
|
34
34
|
it('should respond to #properties') { expect(section).to respond_to(:properties) }
|
35
35
|
|
36
|
+
it "should expose the names of the properties through its property collection" do
|
37
|
+
expect(section.properties.keys).to eq([:title])
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should expose the the properties through its property collection" do
|
41
|
+
properties = subsection.properties.values
|
42
|
+
expect(properties.first).to be_kind_of(SmartProperties::Property)
|
43
|
+
expect(properties.first.name).to eq(:title)
|
44
|
+
end
|
45
|
+
|
36
46
|
context 'an instance of this class' do
|
37
47
|
subject { section.new }
|
38
48
|
it { is_expected.to have_smart_property(:title) }
|
@@ -48,6 +58,19 @@ RSpec.describe SmartProperties, 'intheritance' do
|
|
48
58
|
context 'the subsectionclass' do
|
49
59
|
it('should respond to #properties') { expect(subsection).to respond_to(:properties) }
|
50
60
|
|
61
|
+
it "should expose the names of the properties through its property collection" do
|
62
|
+
expect(subsection.properties.keys).to eq([:title, :subtitle])
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should expose the the properties through its property collection" do
|
66
|
+
properties = subsection.properties.values
|
67
|
+
expect(properties.first).to be_kind_of(SmartProperties::Property)
|
68
|
+
expect(properties.first.name).to eq(:title)
|
69
|
+
|
70
|
+
expect(properties.last).to be_kind_of(SmartProperties::Property)
|
71
|
+
expect(properties.last.name).to eq(:subtitle)
|
72
|
+
end
|
73
|
+
|
51
74
|
context 'an instance of this class' do
|
52
75
|
subject(:instance) { subsection.new }
|
53
76
|
it { is_expected.to have_smart_property(:title) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_properties
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Tennhard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|