From cdc312872738d0b8e33740397fe963a2a96b54cb Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Thu, 9 Jan 2014 00:51:16 +0000 Subject: [PATCH] Implement Action#remote (delegates to remote.fs) --- lib/producer/core/action.rb | 1 + lib/producer/core/actions/file_writer.rb | 2 +- spec/producer/core/action_spec.rb | 6 ++++++ spec/producer/core/actions/file_writer_spec.rb | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/producer/core/action.rb b/lib/producer/core/action.rb index 4678f18..8e83b66 100644 --- a/lib/producer/core/action.rb +++ b/lib/producer/core/action.rb @@ -5,6 +5,7 @@ module Producer extend Forwardable def_delegators :@env, :output, :remote + def_delegators :remote, :fs attr_accessor :env, :arguments diff --git a/lib/producer/core/actions/file_writer.rb b/lib/producer/core/actions/file_writer.rb index b142204..1bac1bf 100644 --- a/lib/producer/core/actions/file_writer.rb +++ b/lib/producer/core/actions/file_writer.rb @@ -3,7 +3,7 @@ module Producer module Actions class FileWriter < Action def apply - remote.fs.file_write path, content + fs.file_write path, content end def path diff --git a/spec/producer/core/action_spec.rb b/spec/producer/core/action_spec.rb index 8da6338..39137d9 100644 --- a/spec/producer/core/action_spec.rb +++ b/spec/producer/core/action_spec.rb @@ -31,5 +31,11 @@ module Producer::Core expect(action.remote).to be action.env.remote end end + + describe '#fs' do + it 'returns env remote fs' do + expect(action.fs).to be action.env.remote.fs + end + end end end diff --git a/spec/producer/core/actions/file_writer_spec.rb b/spec/producer/core/actions/file_writer_spec.rb index 20cbaee..d46c47b 100644 --- a/spec/producer/core/actions/file_writer_spec.rb +++ b/spec/producer/core/actions/file_writer_spec.rb @@ -8,8 +8,8 @@ module Producer::Core subject(:writer) { Actions::FileWriter.new(env, path, content) } describe '#apply' do - it 'writes the content to remote file' do - expect(writer.remote.fs).to receive(:file_write).with(path, content) + it 'writes content to file on remote filesystem' do + expect(writer.fs).to receive(:file_write).with(path, content) writer.apply end end