Allow `mkdir' action to work recursively
This commit is contained in:
@@ -9,6 +9,8 @@ module Producer::Core
|
||||
it_behaves_like 'action'
|
||||
|
||||
describe '#apply' do
|
||||
before { allow(remote_fs).to receive(:dir?) { false } }
|
||||
|
||||
it 'creates directory on remote filesystem' do
|
||||
expect(remote_fs).to receive(:mkdir).with(path)
|
||||
mkdir.apply
|
||||
@@ -22,6 +24,25 @@ module Producer::Core
|
||||
mkdir.apply
|
||||
end
|
||||
end
|
||||
|
||||
context 'when parent directories does not exists' do
|
||||
let(:path) { 'some/path' }
|
||||
|
||||
it 'creates parent directories' do
|
||||
expect(remote_fs).to receive(:mkdir).with('some').ordered
|
||||
expect(remote_fs).to receive(:mkdir).with('some/path').ordered
|
||||
mkdir.apply
|
||||
end
|
||||
end
|
||||
|
||||
context 'when directory already exists' do
|
||||
before { allow(remote_fs).to receive(:dir?) { true } }
|
||||
|
||||
it 'creates directory on remote filesystem' do
|
||||
expect(remote_fs).not_to receive(:mkdir)
|
||||
mkdir.apply
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user