1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
Feature: Running shell commands
You can run an *ad hoc* script with the following steps:
- `When I run the following script:`
Or you can run shell commands with:
- `I run the following (bash|zsh|...shell)? commands`
- `I run the following (bash|zsh|...shell)? commands (in|with) \`interpreter\``
- `I run the following (bash|zsh|...shell)? commands (in|with) \`/path/to/interpreter\``
Background:
Given I use a fixture named "cli-app"
Scenario: Creating and running scripts
Given a file named "features/shell.feature" with:
"""
Feature: Running scripts
Scenario: Running ruby script
When I run the following script:
\"\"\"bash
#!/usr/bin/env ruby
puts "Hello"
\"\"\"
Then the output should contain "Hello"
Scenario: Running python script
When I run the following script:
\"\"\"bash
#!/usr/bin/env python
print("Hello")
\"\"\"
Then the output should contain exactly "Hello"
"""
When I run `cucumber`
Then the features should all pass
Scenario: Running shell commands
Given a file named "features/shell.feature" with:
"""
Feature: Running scripts
Scenario: Running shell commands
When I run the following commands:
\"\"\"bash
echo "Hello shell"
\"\"\"
Then the output should contain exactly "Hello shell"
"""
When I run `cucumber`
Then the features should all pass
Scenario: Running bash commands
Given a file named "features/shell.feature" with:
"""
Feature: Running scripts
Scenario: Running bash commands
When I run the following commands with `bash`:
\"\"\"bash
echo -n "Hello "
echo `echo bash` # subshell
\"\"\"
Then the output should contain exactly "Hello bash"
"""
When I run `cucumber`
Then the features should all pass
Scenario: Running zsh commands
Given a file named "features/shell.feature" with:
"""
Feature: Running zsh scripts
Scenario: Running zsh commands
When I run the following commands with `zsh`:
\"\"\"bash
echo "Hello \c"
echo $((2 + 2))
\"\"\"
Then the output should contain exactly "Hello 4"
"""
When I run `cucumber`
Then the features should all pass
Scenario: Running ruby commands
Given a file named "features/shell.feature" with:
"""
Feature: Running scripts
Scenario: Running ruby commands
When I run the following commands with `ruby`:
\"\"\"ruby
puts "Hello, Aruba!"
\"\"\"
Then the output should contain "Hello, Aruba!"
"""
When I run `cucumber`
Then the features should all pass
Scenario: Running python commands
Given a file named "features/shell.feature" with:
"""
Feature: Running scripts
Scenario: Running ruby commands
When I run the following commands with `python`:
\"\"\"ruby
print("Hello, Aruba!")
\"\"\"
Then the output should contain exactly "Hello, Aruba!"
"""
When I run `cucumber`
Then the features should all pass
Scenario: Running commands if full path to interpreter is given
Given a file named "features/shell.feature" with:
"""
Feature: Running full path zsh
Scenario: Running zsh commands #1
When I run the following commands with `/bin/zsh`:
\"\"\"bash
echo "Hello \c"
echo $((6 - 2))
\"\"\"
Then the output should contain exactly "Hello 4"
Scenario: Running zsh commands #1
When I run the following commands in `/bin/zsh`:
\"\"\"bash
echo "Hello \c"
echo $((6 - 2))
\"\"\"
Then the output should contain exactly "Hello 4"
"""
When I run `cucumber`
Then the features should all pass
Scenario: Running commands if only the name of interpreter is given
Given a file named "features/shell.feature" with:
"""
Feature: Running full path zsh
Scenario: Running zsh commands #1
When I run the following commands with `zsh`:
\"\"\"bash
echo "Hello \c"
echo $((6 - 2))
\"\"\"
Then the output should contain exactly "Hello 4"
Scenario: Running zsh commands #2
When I run the following commands in `zsh`:
\"\"\"bash
echo "Hello \c"
echo $((6 - 2))
\"\"\"
Then the output should contain exactly "Hello 4"
"""
When I run `cucumber`
Then the features should all pass
|