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
|
Feature: Return last command stopped
Background:
Given I use a fixture named "cli-app"
Scenario: A command has been started
Given a file named "spec/run_spec.rb" with:
"""ruby
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
before(:each) { run_command('echo hello') }
before(:each) { stop_all_commands }
it { expect(last_command_stopped).to be_successfully_executed }
it { expect(last_command_stopped.commandline).to eq 'echo hello' }
end
"""
When I run `rspec`
Then the specs should all pass
Scenario: Multiple commands have been started and all are stopped
Given a file named "spec/run_spec.rb" with:
"""ruby
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
before(:each) { run_command('echo hello') }
before(:each) { run_command('echo world') }
before(:each) { stop_all_commands }
it { expect(last_command_stopped).to be_successfully_executed }
it { expect(last_command_stopped.commandline).to eq 'echo world' }
end
"""
When I run `rspec`
Then the specs should all pass
Scenario: Multiple commands have been started and a single one is stopped
Given a file named "spec/run_spec.rb" with:
"""ruby
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
before(:each) { run_command('echo hello') }
before(:each) { find_command('echo hello').stop }
before(:each) { run_command('echo world') }
it { expect(last_command_stopped).to be_successfully_executed }
it { expect(last_command_stopped.commandline).to eq 'echo hello' }
end
"""
When I run `rspec`
Then the specs should all pass
@requires-aruba-version-1
Scenario: No command has been started
Given a file named "spec/run_spec.rb" with:
"""ruby
require 'spec_helper'
RSpec.describe 'Run command', :type => :aruba do
it { expect{ last_command_stopped.commandline }.to raise_error Aruba::NoCommandHasBeenStoppedError }
end
"""
When I run `rspec`
Then the specs should all pass
@requires-aruba-version-1
Scenario: No command has been stopped
Given an executable named "bin/cli" with:
"""bash
#!/bin/bash
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 do
before(:each) { run_command('cli') }
it { expect{ last_command_stopped.commandline }.to raise_error Aruba::NoCommandHasBeenStoppedError }
end
"""
When I run `rspec`
Then the specs should all pass
|