forked from cucumber/aruba
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommand.feature
51 lines (44 loc) · 1.26 KB
/
command.feature
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
Feature: After command hooks
You can configure Aruba to run blocks of code after it has run
a command. The command will be passed to the block.
You can hook into Aruba's lifecycle just before it runs a command and after it has run the command:
```ruby
require 'aruba'
Aruba.configure do |config|
config.after :command do |cmd|
puts "After the run of '#{cmd}'"
end
end
```
Background:
Given I use a fixture named "cli-app"
Scenario: Run a simple command with an "after(:command)"-hook
Given a file named "features/support/hooks.rb" with:
"""
require_relative 'aruba'
Aruba.configure do |config|
config.after :command do |cmd|
puts "after the run of `#{cmd.commandline}`"
end
end
"""
And a file named "features/use_aruba_with_cucumber.feature" with:
"""
Feature: Cucumber
Scenario: First Run
Given a file named "file.txt" with:
\"\"\"
Hello World
\"\"\"
When I successfully run `cat file.txt`
Then the output should contain:
\"\"\"
Hello World
\"\"\"
"""
When I run `cucumber`
Then the features should all pass
And the output should contain:
"""
after the run of `cat file.txt`
"""