Logo: Relish

  1. Sign in

Project: Aruba 0.11.0

Return last command started

Background
Given
I use a fixture named "cli-app"
Scenarios
A command has been started
Given
a file named "spec/run_spec.rb" with:
require 'spec_helper'

RSpec.describe 'Run command', :type => :aruba do
  before(:each) { run('echo hello') }
  before(:each) { stop_all_commands }

  it { expect(last_command_started).to be_successfully_executed }
  it { expect(last_command_started.commandline).to eq 'echo hello' }
end
When
I run rspec
Then
the specs should all pass
Multiple commands have been started
Given
a file named "spec/run_spec.rb" with:
require 'spec_helper'

RSpec.describe 'Run command', :type => :aruba do
  before(:each) { run('echo hello') }
  before(:each) { run('echo world') }

  before(:each) { stop_all_commands }

  it { expect(last_command_started).to be_successfully_executed }
  it { expect(last_command_started.commandline).to eq 'echo world' }
end
When
I run rspec
Then
the specs should all pass
No command has been started
Given
a file named "spec/run_spec.rb" with:
require 'spec_helper'

RSpec.describe 'Run command', :type => :aruba do
  it { expect{ last_command_started.commandline }.to raise_error Aruba::NoCommandHasBeenStartedError }
end
When
I run rspec
Then
the specs should all pass

Last published about 6 years ago by Max Meyer.