hq-dev 0.0.14 → 0.0.15
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/command.feature +35 -9
- data/lib/hq/cucumber/command.rb +29 -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: 01f16e12ae07fafe4611531e4166a24e8dca6081
|
4
|
+
data.tar.gz: b28bb86247c3e29aab501bb883dbdac35e42289e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1794edc9d59561e48ae34c832d7e93df6365af2598efeecc186177769ed723e449ffad810c4ffc927e8aedd429b6332825dc13955daa3250619caeebfe6eeb03
|
7
|
+
data.tar.gz: a66f1a5586cb20889d153f9c725de915c01236ed91b4006e131b5889210d47cceb2abc732e73bd92bac52fdc9e92e3990b742d115e14afcb29916313d11d873e
|
data/data/gem-versions
CHANGED
data/features/command.feature
CHANGED
@@ -18,16 +18,9 @@ Feature: Command invocation
|
|
18
18
|
$commands["command"] = CommandScript
|
19
19
|
"""
|
20
20
|
|
21
|
-
Scenario: Invoke a script
|
21
|
+
Scenario: Invoke a script with an args file
|
22
22
|
|
23
|
-
Given a file "features/
|
24
|
-
"""
|
25
|
-
Then /^the file is created correctly$/ do
|
26
|
-
File.read("abc.def").should == "Hello world"
|
27
|
-
end
|
28
|
-
"""
|
29
|
-
|
30
|
-
And a file "features/test.feature":
|
23
|
+
Given a file "features/test.feature":
|
31
24
|
"""
|
32
25
|
Feature:
|
33
26
|
Scenario: Invoke script
|
@@ -56,3 +49,36 @@ Feature: Command invocation
|
|
56
49
|
5 steps (5 passed)
|
57
50
|
"""
|
58
51
|
And the exit status should be 0
|
52
|
+
|
53
|
+
Scenario: Execute a shell command
|
54
|
+
|
55
|
+
Given a file "features/test.feature":
|
56
|
+
"""
|
57
|
+
Feature:
|
58
|
+
Scenario: Run script
|
59
|
+
Given a file "command":
|
60
|
+
\"\"\"
|
61
|
+
echo hello standard output
|
62
|
+
echo hello standard error >&2
|
63
|
+
exit 123
|
64
|
+
\"\"\"
|
65
|
+
When I run "bash command"
|
66
|
+
Then the command stdout should be:
|
67
|
+
\"\"\"
|
68
|
+
hello standard output
|
69
|
+
\"\"\"
|
70
|
+
And the command stderr should be:
|
71
|
+
\"\"\"
|
72
|
+
hello standard error
|
73
|
+
\"\"\"
|
74
|
+
And the command exit status should be 123
|
75
|
+
"""
|
76
|
+
|
77
|
+
When I run "cucumber"
|
78
|
+
|
79
|
+
Then the output should contain:
|
80
|
+
"""
|
81
|
+
1 scenario (1 passed)
|
82
|
+
5 steps (5 passed)
|
83
|
+
"""
|
84
|
+
And the exit status should be 0
|
data/lib/hq/cucumber/command.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "shellwords"
|
2
|
+
require "tempfile"
|
2
3
|
|
3
4
|
$commands = {}
|
4
5
|
|
@@ -22,6 +23,34 @@ When /^I invoke (\S+) with "([^"]+)"$/ do
|
|
22
23
|
|
23
24
|
end
|
24
25
|
|
26
|
+
When /^I run "([^"]+)"$/ do
|
27
|
+
|command_str|
|
28
|
+
|
29
|
+
stdout_temp =
|
30
|
+
Tempfile.new "cuke-command-stdout-"
|
31
|
+
|
32
|
+
stderr_temp =
|
33
|
+
Tempfile.new "cuke-command-stderr-"
|
34
|
+
|
35
|
+
system "(%s) >%s 2>%s" % [
|
36
|
+
command_str,
|
37
|
+
stdout_temp.path,
|
38
|
+
stderr_temp.path,
|
39
|
+
]
|
40
|
+
|
41
|
+
@command_exit_status = $?.exitstatus
|
42
|
+
|
43
|
+
@command_stdout =
|
44
|
+
File.read stdout_temp.path
|
45
|
+
|
46
|
+
@command_stderr =
|
47
|
+
File.read stderr_temp.path
|
48
|
+
|
49
|
+
stdout_temp.unlink
|
50
|
+
stderr_temp.unlink
|
51
|
+
|
52
|
+
end
|
53
|
+
|
25
54
|
Then /^the command stdout should be:$/ do
|
26
55
|
|stdout_expect|
|
27
56
|
|