data_magic 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +3 -0
- data/lib/data_magic.rb +2 -2
- data/lib/data_magic/version.rb +1 -1
- data/spec/lib/translation_spec.rb +10 -1
- metadata +8 -8
data/ChangeLog
CHANGED
data/lib/data_magic.rb
CHANGED
@@ -8,10 +8,10 @@ require 'faker'
|
|
8
8
|
module DataMagic
|
9
9
|
include Translation
|
10
10
|
|
11
|
-
def data_for(key)
|
11
|
+
def data_for(key, additional={})
|
12
12
|
DataMagic.load('default.yml') unless DataMagic.yml
|
13
13
|
data = DataMagic.yml[key]
|
14
|
-
prep_data data.clone
|
14
|
+
prep_data data.merge(additional).clone
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
data/lib/data_magic/version.rb
CHANGED
@@ -17,7 +17,6 @@ describe "DataMagic translations" do
|
|
17
17
|
example.data_for('key').should have_field_value 'value'
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
20
|
it "should default to use a file named 'default.yml'" do
|
22
21
|
DataMagic::Config.yml_directory = 'test'
|
23
22
|
YAML.should_receive(:load_file).with("test/default.yml").and_return({})
|
@@ -27,9 +26,19 @@ describe "DataMagic translations" do
|
|
27
26
|
end
|
28
27
|
|
29
28
|
it "should clone the data returned so it can be resued" do
|
29
|
+
yaml = double('yaml')
|
30
|
+
yaml.stub(:merge).and_return(yaml)
|
31
|
+
DataMagic.should_receive(:yml).twice.and_return(yaml)
|
32
|
+
yaml.should_receive(:[]).and_return(yaml)
|
33
|
+
yaml.should_receive(:clone).and_return({'field' => 'value'})
|
34
|
+
example.data_for('key').should have_field_value 'value'
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should merge the provided data with the yaml data" do
|
30
38
|
yaml = double('yaml')
|
31
39
|
DataMagic.should_receive(:yml).twice.and_return(yaml)
|
32
40
|
yaml.should_receive(:[]).and_return(yaml)
|
41
|
+
yaml.should_receive(:merge).and_return(yaml)
|
33
42
|
yaml.should_receive(:clone).and_return({'field' => 'value'})
|
34
43
|
example.data_for('key').should have_field_value 'value'
|
35
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_magic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
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-
|
12
|
+
date: 2012-02-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faker
|
16
|
-
requirement: &
|
16
|
+
requirement: &70184023220840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.0.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70184023220840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70184023220040 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.6.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70184023220040
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: cucumber
|
38
|
-
requirement: &
|
38
|
+
requirement: &70184023219280 !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: *70184023219280
|
47
47
|
description: Provides datasets to application stored in YAML files
|
48
48
|
email:
|
49
49
|
- jeff.morgan@leandog.com
|