fig_newton 0.1 → 0.2
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.
- data/.travis.yml +8 -0
- data/ChangeLog +6 -0
- data/README.md +2 -0
- data/config/yaml/test_config.yml +9 -0
- data/cucumber.yml +1 -1
- data/features/fig_newton.feature +13 -0
- data/features/step_definitions/fig_newton_steps.rb +13 -0
- data/lib/fig_newton.rb +4 -8
- data/lib/fig_newton/missing.rb +11 -0
- data/lib/fig_newton/node.rb +11 -0
- data/lib/fig_newton/version.rb +1 -1
- metadata +12 -8
data/.travis.yml
ADDED
data/ChangeLog
ADDED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# FigNewton
|
2
2
|
|
3
|
+
[](http://travis-ci.org/cheezy/fig_newton)
|
4
|
+
|
3
5
|
Manages configuration for test suites. It is common to need different configuration information for different test environments. For example, the base_url or database login information might change when you move from development to a test environment. FigNewton makes it simple to create and use this information.
|
4
6
|
|
5
7
|
## Usage
|
data/config/yaml/test_config.yml
CHANGED
data/cucumber.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
default: --no-source --color --format
|
1
|
+
default: --no-source --color --format pretty
|
data/features/fig_newton.feature
CHANGED
@@ -10,3 +10,16 @@ Feature: Functionality of the fig_newton gem
|
|
10
10
|
When I ask for a value that does not exist named "does_not_exist"
|
11
11
|
Then I should raise a NoMethodError exception
|
12
12
|
|
13
|
+
Scenario: Requesting data that contains a node of additional data
|
14
|
+
Given I have read the configuration file
|
15
|
+
When I ask for the value for "database"
|
16
|
+
Then I should have a node
|
17
|
+
And the "username" value for the node should be "steve"
|
18
|
+
And the "password" value for the node should be "secret"
|
19
|
+
|
20
|
+
Scenario: Requesting data from multiple nested data
|
21
|
+
Given I have read the configuration file
|
22
|
+
When I ask for the value for "first"
|
23
|
+
And I ask for the node value for "second"
|
24
|
+
Then the "third" value for the node should be "foo"
|
25
|
+
And the "fourth" value for the node should be "bar"
|
@@ -17,3 +17,16 @@ end
|
|
17
17
|
Then /^I should raise a NoMethodError exception$/ do
|
18
18
|
expect{ FigNewton.send(@does_not_exist) }.to raise_error(NoMethodError)
|
19
19
|
end
|
20
|
+
|
21
|
+
Then /^I should have a node$/ do
|
22
|
+
@value.should be_an_instance_of FigNewton::Node
|
23
|
+
end
|
24
|
+
|
25
|
+
Then /^the "([^\"]*)" value for the node should be "([^\"]*)"$/ do |key, value|
|
26
|
+
@value.send(key).should == value
|
27
|
+
end
|
28
|
+
|
29
|
+
When /^I ask for the node value for "([^\"]*)"$/ do |key|
|
30
|
+
@value = @value.send(key)
|
31
|
+
end
|
32
|
+
|
data/lib/fig_newton.rb
CHANGED
@@ -1,17 +1,13 @@
|
|
1
|
-
require
|
1
|
+
require 'fig_newton/version'
|
2
|
+
require 'fig_newton/node'
|
3
|
+
require 'fig_newton/missing'
|
2
4
|
require 'yml_reader'
|
3
5
|
|
4
6
|
module FigNewton
|
5
7
|
extend YmlReader
|
8
|
+
extend FigNewton::Missing
|
6
9
|
|
7
10
|
def self.default_directory
|
8
11
|
'config/environments'
|
9
12
|
end
|
10
|
-
|
11
|
-
def self.method_missing(*args, &block)
|
12
|
-
m = args.first
|
13
|
-
value = @yml[m.to_s]
|
14
|
-
super unless value
|
15
|
-
value
|
16
|
-
end
|
17
13
|
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.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yml_reader
|
16
|
-
requirement: &
|
16
|
+
requirement: &70353545646100 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70353545646100
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70353545645600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.8.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70353545645600
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: cucumber
|
38
|
-
requirement: &
|
38
|
+
requirement: &70353545645140 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 1.1.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70353545645140
|
47
47
|
description: Provides a simple mechanism to maintain and use different configurations
|
48
48
|
stored in yml files.
|
49
49
|
email:
|
@@ -55,6 +55,8 @@ files:
|
|
55
55
|
- .gitignore
|
56
56
|
- .rspec
|
57
57
|
- .rvmrc
|
58
|
+
- .travis.yml
|
59
|
+
- ChangeLog
|
58
60
|
- Gemfile
|
59
61
|
- Guardfile
|
60
62
|
- LICENSE
|
@@ -67,6 +69,8 @@ files:
|
|
67
69
|
- features/support/env.rb
|
68
70
|
- fig_newton.gemspec
|
69
71
|
- lib/fig_newton.rb
|
72
|
+
- lib/fig_newton/missing.rb
|
73
|
+
- lib/fig_newton/node.rb
|
70
74
|
- lib/fig_newton/version.rb
|
71
75
|
- spec/fig_newton/fig_newton_spec.rb
|
72
76
|
- spec/spec_helper.rb
|