Fail when `file_replace_content' misses arguments
This commit is contained in:
parent
58f3a7223e
commit
fdfd5df26f
@ -3,6 +3,7 @@ module Producer
|
||||
module Actions
|
||||
class FileReplaceContent < Action
|
||||
def setup
|
||||
check_arguments_size! 3
|
||||
@path, @pattern, @replacement = arguments
|
||||
end
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user