Accept mode as argument in `file_write' action

This commit is contained in:
Thibault Jouan
2014-04-24 23:46:43 +00:00
parent 47412d8bce
commit 5cb6296057
6 changed files with 64 additions and 5 deletions

View File

@@ -14,6 +14,16 @@ module Producer::Core
expect(remote_fs).to receive(:file_write).with(path, content)
writer.apply
end
context 'when a mode was given' do
subject(:writer) { FileWriter.new(env, path, content, 0600) }
it 'specifies the given mode' do
expect(remote_fs)
.to receive(:file_write).with(anything, anything, 0600)
writer.apply
end
end
end
describe '#path' do
@@ -27,6 +37,20 @@ module Producer::Core
expect(writer.content).to eq content
end
end
describe '#mode' do
it 'returns nil' do
expect(writer.mode).to be nil
end
context 'when a mode was given' do
subject(:writer) { FileWriter.new(env, path, content, 0600) }
it 'returns the mode' do
expect(writer.mode).to eq 0600
end
end
end
end
end
end