Fail when `file_append' misses some arguments
This commit is contained in:
parent
770f4df51e
commit
5549ebc676
@ -3,6 +3,10 @@ module Producer
|
|||||||
module Actions
|
module Actions
|
||||||
class FileAppend < Action
|
class FileAppend < Action
|
||||||
def setup
|
def setup
|
||||||
|
if arguments.compact.size != 2
|
||||||
|
fail ArgumentError, '`%s\' action requires 2 arguments' % name
|
||||||
|
end
|
||||||
|
|
||||||
@path, @content = arguments
|
@path, @content = arguments
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -12,6 +12,16 @@ module Producer::Core
|
|||||||
|
|
||||||
before { allow(remote_fs).to receive(:file_read).with(path) { content } }
|
before { allow(remote_fs).to receive(:file_read).with(path) { content } }
|
||||||
|
|
||||||
|
describe '#setup' do
|
||||||
|
context 'when content is missing' do
|
||||||
|
let(:added_content) { nil }
|
||||||
|
|
||||||
|
it 'raises ArgumentError' do
|
||||||
|
expect { action }.to raise_error ArgumentError
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#apply' do
|
describe '#apply' do
|
||||||
it 'appends given content to requested file on remote filesystem' do
|
it 'appends given content to requested file on remote filesystem' do
|
||||||
expect(remote_fs)
|
expect(remote_fs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user