yaml_properties 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +20 -0
- data/lib/yaml_properties/version.rb +1 -1
- data/lib/yaml_properties.rb +8 -0
- data/spec/yaml_config_spec.rb +7 -0
- metadata +24 -26
data/README.md
CHANGED
@@ -33,6 +33,26 @@ module Shutl
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
```
|
36
|
+
|
37
|
+
##Temporarily override values in e.g. cucumber
|
38
|
+
```ruby
|
39
|
+
|
40
|
+
#lib/shutl.rb
|
41
|
+
module Shutl
|
42
|
+
extend YamlProperties
|
43
|
+
end
|
44
|
+
|
45
|
+
#features/support/env.rb
|
46
|
+
After do |scenario|
|
47
|
+
YamlProperties.reset!
|
48
|
+
end
|
49
|
+
|
50
|
+
#features/step_definitions/egg_steps.rb
|
51
|
+
Given /\AThere are \d+ eggs in a dozen\z/ |dozen|
|
52
|
+
YamlProperties.override_attribute :egg, dozen
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
36
56
|
#Yadayada
|
37
57
|
|
38
58
|
```ruby
|
data/lib/yaml_properties.rb
CHANGED
@@ -6,6 +6,10 @@ module YamlProperties
|
|
6
6
|
@properties ||= load_properties.with_indifferent_access
|
7
7
|
end
|
8
8
|
|
9
|
+
def reset!
|
10
|
+
reset_properties
|
11
|
+
end
|
12
|
+
|
9
13
|
def reset_properties
|
10
14
|
@properties = nil
|
11
15
|
end
|
@@ -16,6 +20,10 @@ module YamlProperties
|
|
16
20
|
super key, *args, &block
|
17
21
|
end
|
18
22
|
|
23
|
+
def override_attribute attribute, value
|
24
|
+
properties[attribute] = value
|
25
|
+
end
|
26
|
+
|
19
27
|
private
|
20
28
|
|
21
29
|
def yaml_file
|
data/spec/yaml_config_spec.rb
CHANGED
@@ -19,6 +19,13 @@ describe YamlProperties do
|
|
19
19
|
}
|
20
20
|
end
|
21
21
|
|
22
|
+
specify "overriding attributes (in e.g. tests)" do
|
23
|
+
YamlProperties.override_attribute :life_the_universe_and_everything, 13
|
24
|
+
YamlProperties.life_the_universe_and_everything.should == 13
|
25
|
+
YamlProperties.reset!
|
26
|
+
YamlProperties.life_the_universe_and_everything.should == 42
|
27
|
+
end
|
28
|
+
|
22
29
|
specify do
|
23
30
|
YamlProperties.properties.should == properties
|
24
31
|
end
|
metadata
CHANGED
@@ -1,64 +1,64 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaml_properties
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
version: 0.0.8
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mark Burns
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
17
18
|
requirements:
|
18
19
|
- - ! '>='
|
19
20
|
- !ruby/object:Gem::Version
|
20
21
|
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
25
|
none: false
|
22
|
-
requirement: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0'
|
27
|
-
none: false
|
28
|
-
prerelease: false
|
29
|
-
type: :runtime
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rspec
|
32
|
-
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
33
34
|
requirements:
|
34
35
|
- - ! '>='
|
35
36
|
- !ruby/object:Gem::Version
|
36
37
|
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
41
|
none: false
|
38
|
-
requirement: !ruby/object:Gem::Requirement
|
39
42
|
requirements:
|
40
43
|
- - ! '>='
|
41
44
|
- !ruby/object:Gem::Version
|
42
45
|
version: '0'
|
43
|
-
none: false
|
44
|
-
prerelease: false
|
45
|
-
type: :development
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: debugger
|
48
|
-
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
49
50
|
requirements:
|
50
51
|
- - ! '>='
|
51
52
|
- !ruby/object:Gem::Version
|
52
53
|
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
57
|
none: false
|
54
|
-
requirement: !ruby/object:Gem::Requirement
|
55
58
|
requirements:
|
56
59
|
- - ! '>='
|
57
60
|
- !ruby/object:Gem::Version
|
58
61
|
version: '0'
|
59
|
-
none: false
|
60
|
-
prerelease: false
|
61
|
-
type: :development
|
62
62
|
description: Easily add configurable variables for app config using YAML files
|
63
63
|
email:
|
64
64
|
- markthedeveloper@gmail.com
|
@@ -89,26 +89,26 @@ files:
|
|
89
89
|
- yaml_properties.gemspec
|
90
90
|
homepage: ''
|
91
91
|
licenses: []
|
92
|
-
post_install_message:
|
92
|
+
post_install_message:
|
93
93
|
rdoc_options: []
|
94
94
|
require_paths:
|
95
95
|
- lib
|
96
96
|
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
97
98
|
requirements:
|
98
99
|
- - ! '>='
|
99
100
|
- !ruby/object:Gem::Version
|
100
101
|
version: '0'
|
101
|
-
none: false
|
102
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
103
104
|
requirements:
|
104
105
|
- - ! '>='
|
105
106
|
- !ruby/object:Gem::Version
|
106
107
|
version: '0'
|
107
|
-
none: false
|
108
108
|
requirements: []
|
109
|
-
rubyforge_project:
|
109
|
+
rubyforge_project:
|
110
110
|
rubygems_version: 1.8.24
|
111
|
-
signing_key:
|
111
|
+
signing_key:
|
112
112
|
specification_version: 3
|
113
113
|
summary: ! 'Example: YamlProperties.life_the_universe_and_everything #=> 42 In config/properties.yml
|
114
114
|
life_the_universe_and_everything: 42'
|
@@ -121,5 +121,3 @@ test_files:
|
|
121
121
|
- spec/fixtures/test.yml
|
122
122
|
- spec/spec_helper.rb
|
123
123
|
- spec/yaml_config_spec.rb
|
124
|
-
has_rdoc:
|
125
|
-
...
|