Logo: Relish

  1. Sign in

Project: Aruba 0.9.0

Run command

To run a command use the #run-method.

Background
Given
I use a fixture named "cli-app"
Scenarios
Existing executable
Given
an executable named "bin/cli" with:
#!/bin/bash
exit 0
And
a file named "spec/which_spec.rb" with:
require 'spec_helper'

RSpec.describe 'Run command', :type => :aruba do
  before(:each) { run('cli') }
  it { expect(last_command_started).to be_successfully_executed }
end
When
I run rspec
Then
the specs should all pass
Non-existing executable
Given
a file named "bin/cli" does not exist
And
a file named "spec/which_spec.rb" with:
require 'spec_helper'

RSpec.describe 'Find path for command', :type => :aruba do
  it { expect { run('cli') }.to raise_error Aruba::LaunchError, /No such file or directory - cli/ }
end
When
I run rspec
Then
the specs should all pass

Last published over 6 years ago by Max Meyer.