fig_newton 0.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -2
- data/ChangeLog +4 -0
- data/config/yaml/test_config.yml +2 -0
- data/features/fig_newton.feature +4 -0
- data/features/step_definitions/fig_newton_steps.rb +4 -0
- data/lib/fig_newton/missing.rb +6 -1
- data/lib/fig_newton/version.rb +1 -1
- metadata +4 -4
data/.travis.yml
CHANGED
data/ChangeLog
CHANGED
data/config/yaml/test_config.yml
CHANGED
data/features/fig_newton.feature
CHANGED
@@ -34,3 +34,7 @@ Feature: Functionality of the fig_newton gem
|
|
34
34
|
When I ask for the value for "base_url"
|
35
35
|
Then I should see "http://cheezyworld.com"
|
36
36
|
|
37
|
+
Scenario: Requesting a numerical value
|
38
|
+
Given I have read the configuration file
|
39
|
+
When I ask for the value for "port"
|
40
|
+
Then I should see 1234
|
@@ -15,6 +15,10 @@ Then /^I should see "([^\"]*)"$/ do |value|
|
|
15
15
|
@value.should == value
|
16
16
|
end
|
17
17
|
|
18
|
+
Then /^I should see (\d+)$/ do |value|
|
19
|
+
@value.should == value.to_i
|
20
|
+
end
|
21
|
+
|
18
22
|
When /^I ask for a value that does not exist named "([^\"]*)"$/ do |non_existing|
|
19
23
|
@does_not_exist = non_existing
|
20
24
|
end
|
data/lib/fig_newton/missing.rb
CHANGED
@@ -5,7 +5,7 @@ module FigNewton
|
|
5
5
|
m = args.first
|
6
6
|
value = @yml[m.to_s]
|
7
7
|
super unless value
|
8
|
-
value = FigNewton::Node.new(value) unless
|
8
|
+
value = FigNewton::Node.new(value) unless type_known? value
|
9
9
|
value
|
10
10
|
end
|
11
11
|
|
@@ -13,5 +13,10 @@ module FigNewton
|
|
13
13
|
@yml = YAML.load_file "#{yml_directory}/#{ENV['FIG_NEWTON_FILE']}" if ENV['FIG_NEWTON_FILE']
|
14
14
|
FigNewton.load('default.yml') unless ENV['FIG_NEWTON_FILE']
|
15
15
|
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def type_known?(value)
|
19
|
+
value.kind_of? String or value.kind_of? Integer
|
20
|
+
end
|
16
21
|
end
|
17
22
|
end
|
data/lib/fig_newton/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fig_newton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.6'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yml_reader
|
@@ -105,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
segments:
|
107
107
|
- 0
|
108
|
-
hash:
|
108
|
+
hash: 2254345954836371452
|
109
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
110
|
none: false
|
111
111
|
requirements:
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
version: '0'
|
115
115
|
segments:
|
116
116
|
- 0
|
117
|
-
hash:
|
117
|
+
hash: 2254345954836371452
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
120
|
rubygems_version: 1.8.24
|