Accept mode as argument in `file_write' action
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user