Fail when `sh' misses arguments
This commit is contained in:
parent
3f82b923b7
commit
3cc52bb1a8
@ -2,12 +2,17 @@ module Producer
|
|||||||
module Core
|
module Core
|
||||||
module Actions
|
module Actions
|
||||||
class ShellCommand < Action
|
class ShellCommand < Action
|
||||||
|
def setup
|
||||||
|
check_arguments_size! 1
|
||||||
|
@command = arguments.first
|
||||||
|
end
|
||||||
|
|
||||||
def name
|
def name
|
||||||
'sh'
|
'sh'
|
||||||
end
|
end
|
||||||
|
|
||||||
def apply
|
def apply
|
||||||
remote.execute(arguments.first, output, error_output)
|
remote.execute(@command, output, error_output)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -10,6 +10,16 @@ module Producer::Core
|
|||||||
|
|
||||||
it_behaves_like 'action'
|
it_behaves_like 'action'
|
||||||
|
|
||||||
|
describe '#setup' do
|
||||||
|
context 'when command is missing' do
|
||||||
|
let(:command) { nil }
|
||||||
|
|
||||||
|
it 'raises ArgumentError' do
|
||||||
|
expect { sh }.to raise_error ArgumentError
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#apply' do
|
describe '#apply' do
|
||||||
it 'executes the remote command' do
|
it 'executes the remote command' do
|
||||||
expect_execution(command)
|
expect_execution(command)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user