Implement `mkdir' task action
This commit is contained in:
23
spec/producer/core/actions/mkdir_spec.rb
Normal file
23
spec/producer/core/actions/mkdir_spec.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
require 'spec_helper'
|
||||
|
||||
module Producer::Core
|
||||
describe Actions::Mkdir do
|
||||
let(:env) { Env.new }
|
||||
let(:path) { 'some_path' }
|
||||
subject(:mkdir) { Actions::Mkdir.new(env, path) }
|
||||
|
||||
describe '#apply' do
|
||||
it 'creates directory on remote filesystem' do
|
||||
expect(mkdir.fs).to receive(:mkdir).with(path)
|
||||
mkdir.apply
|
||||
end
|
||||
end
|
||||
|
||||
describe '#path' do
|
||||
it 'returns the path' do
|
||||
expect(mkdir.path).to eq path
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -112,6 +112,18 @@ module Producer::Core
|
||||
end
|
||||
end
|
||||
|
||||
describe '#mkdir' do
|
||||
let(:sftp) { double 'sftp' }
|
||||
let(:path) { 'some_directory_path' }
|
||||
|
||||
before { allow(fs).to receive(:sftp) { sftp } }
|
||||
|
||||
it 'creates the directory' do
|
||||
expect(sftp).to receive(:mkdir!).with(path)
|
||||
fs.mkdir path
|
||||
end
|
||||
end
|
||||
|
||||
describe '#file_write' do
|
||||
let(:sftp) { double('sftp').as_null_object }
|
||||
let(:file) { double('sftp').as_null_object }
|
||||
|
@@ -6,7 +6,7 @@ module Producer::Core
|
||||
let(:env) { Env.new }
|
||||
subject(:dsl) { Task::DSL.new(env, &block) }
|
||||
|
||||
%w[echo sh file_write].each do |action|
|
||||
%w[echo sh mkdir file_write].each do |action|
|
||||
it "has `#{action}' action defined" do
|
||||
expect(dsl).to respond_to action.to_sym
|
||||
end
|
||||
|
Reference in New Issue
Block a user