Fail when `file_replace_content' misses arguments

This commit is contained in:
Thibault Jouan 2014-10-09 20:06:15 +00:00
parent 58f3a7223e
commit fdfd5df26f
2 changed files with 11 additions and 0 deletions

View File

@ -3,6 +3,7 @@ module Producer
module Actions
class FileReplaceContent < Action
def setup
check_arguments_size! 3
@path, @pattern, @replacement = arguments
end

View File

@ -14,6 +14,16 @@ module Producer::Core
before { allow(remote_fs).to receive(:file_read).with(path) { content } }
describe '#setup' do
context 'when content is missing' do
let(:replacement) { nil }
it 'raises ArgumentError' do
expect { action }.to raise_error ArgumentError
end
end
end
describe '#apply' do
it 'writes replaced content to file on remote filesystem' do
expect(remote_fs)