This repository has been archived by the owner on Mar 1, 2019. It is now read-only.
forked from cucumber/aruba
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsend_signal.feature
53 lines (44 loc) · 1.47 KB
/
send_signal.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
52
53
Feature: Send running command a signal
You can send a running command a signal using
`last_command_started#send_signal`. This is only supported with
`aruba.config.command_launcher = :spawn` (default).
Background:
Given I use a fixture named "cli-app"
Scenario: Existing executable
Given an executable named "bin/aruba-test-cli" with:
"""ruby
#!/usr/bin/env bash
function hup {
echo 'Exit...' >&2
exit 0
}
trap hup HUP
while [ true ]; do sleep 1; done
"""
And a file named "spec/run_spec.rb" with:
"""ruby
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 5 do
before(:each) { run('cli') }
before(:each) { last_command_started.send_signal 'HUP' }
it { expect(last_command_started).to have_output /Exit/ }
end
"""
When I run `rspec`
Then the specs should all pass
Scenario: Dying command
Given an executable named "bin/aruba-test-cli" with:
"""ruby
#!/usr/bin/env bash
exit 1
"""
And a file named "spec/run_spec.rb" with:
"""ruby
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba, :exit_timeout => 1, :startup_wait_time => 5 do
before(:each) { run('cli') }
it { expect { last_command_started.send_signal 'HUP' }.to raise_error Aruba::CommandAlreadyStoppedError, /Command "cli" with PID/ }
end
"""
When I run `rspec`
Then the specs should all pass