hq-dev 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/gem-versions +1 -1
- data/features/temp-dir.feature +12 -3
- data/lib/hq/cucumber/temp-dir.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6a564c6509f17e61b34ec035e526a4ee5b98141
|
4
|
+
data.tar.gz: 0571f085434341f02b52dd773fe0774416c46f26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54861def6e4636a4451f9cf67a6976c2428bcc101d35354ef8202cd2b837af164286efabf7021a2aa24ce782781faf1e6fbd4cf07720fdaee93aac387445a6e8
|
7
|
+
data.tar.gz: 4f2e317ba323a41ab5a9d9f38c22fcc558f781074b80ec299bc2ebeb9fce65786226c5bd9c00cbdbec8a968dbb921191c491787135213c0695827462258f4210
|
data/data/gem-versions
CHANGED
data/features/temp-dir.feature
CHANGED
@@ -11,6 +11,9 @@ Feature: Temporary directory and files
|
|
11
11
|
|
12
12
|
Given a file "features/support/steps.rb":
|
13
13
|
"""
|
14
|
+
Before do
|
15
|
+
$placeholders["${name}"] = "world"
|
16
|
+
end
|
14
17
|
Then /^the file is created correctly$/ do
|
15
18
|
File.read("abc.def").should == "Hello world"
|
16
19
|
end
|
@@ -19,12 +22,18 @@ Feature: Temporary directory and files
|
|
19
22
|
And a file "features/test.feature":
|
20
23
|
"""
|
21
24
|
Feature:
|
22
|
-
Scenario:
|
25
|
+
Scenario: Simple file
|
23
26
|
Given a file "abc.def":
|
24
27
|
\"\"\"
|
25
28
|
Hello world
|
26
29
|
\"\"\"
|
27
30
|
Then the file is created correctly
|
31
|
+
Scenario: Placeholders
|
32
|
+
Given a file "abc.def":
|
33
|
+
\"\"\"
|
34
|
+
Hello ${name}
|
35
|
+
\"\"\"
|
36
|
+
Then the file is created correctly
|
28
37
|
"""
|
29
38
|
|
30
39
|
When I run "cucumber"
|
@@ -32,8 +41,8 @@ Feature: Temporary directory and files
|
|
32
41
|
Then the exit status should be 0
|
33
42
|
And the output should contain:
|
34
43
|
"""
|
35
|
-
|
36
|
-
|
44
|
+
2 scenarios (2 passed)
|
45
|
+
4 steps (4 passed)
|
37
46
|
"""
|
38
47
|
|
39
48
|
Scenario: Create a directory
|
data/lib/hq/cucumber/temp-dir.rb
CHANGED
@@ -8,6 +8,8 @@ Before do
|
|
8
8
|
|
9
9
|
Dir.chdir @temp_dir
|
10
10
|
|
11
|
+
$placeholders = {}
|
12
|
+
|
11
13
|
end
|
12
14
|
|
13
15
|
After do
|
@@ -25,6 +27,20 @@ Given /^a file "(.+)":$/ do
|
|
25
27
|
|
26
28
|
FileUtils.mkdir_p dir_name
|
27
29
|
|
30
|
+
regex_str =
|
31
|
+
$placeholders.keys.map {
|
32
|
+
|key|
|
33
|
+
Regexp.quote key
|
34
|
+
}.join("|")
|
35
|
+
|
36
|
+
regex =
|
37
|
+
Regexp.new regex_str
|
38
|
+
|
39
|
+
file_contents =
|
40
|
+
file_contents.gsub(regex) {
|
41
|
+
|key| $placeholders[key]
|
42
|
+
}
|
43
|
+
|
28
44
|
File.open file_name, "w" do
|
29
45
|
|file_io|
|
30
46
|
|