Implement Action#remote (delegates to remote.fs)
This commit is contained in:
parent
29c26ab961
commit
cdc3128727
@ -5,6 +5,7 @@ module Producer
|
|||||||
|
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
def_delegators :@env, :output, :remote
|
def_delegators :@env, :output, :remote
|
||||||
|
def_delegators :remote, :fs
|
||||||
|
|
||||||
attr_accessor :env, :arguments
|
attr_accessor :env, :arguments
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ module Producer
|
|||||||
module Actions
|
module Actions
|
||||||
class FileWriter < Action
|
class FileWriter < Action
|
||||||
def apply
|
def apply
|
||||||
remote.fs.file_write path, content
|
fs.file_write path, content
|
||||||
end
|
end
|
||||||
|
|
||||||
def path
|
def path
|
||||||
|
@ -31,5 +31,11 @@ module Producer::Core
|
|||||||
expect(action.remote).to be action.env.remote
|
expect(action.remote).to be action.env.remote
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#fs' do
|
||||||
|
it 'returns env remote fs' do
|
||||||
|
expect(action.fs).to be action.env.remote.fs
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -8,8 +8,8 @@ module Producer::Core
|
|||||||
subject(:writer) { Actions::FileWriter.new(env, path, content) }
|
subject(:writer) { Actions::FileWriter.new(env, path, content) }
|
||||||
|
|
||||||
describe '#apply' do
|
describe '#apply' do
|
||||||
it 'writes the content to remote file' do
|
it 'writes content to file on remote filesystem' do
|
||||||
expect(writer.remote.fs).to receive(:file_write).with(path, content)
|
expect(writer.fs).to receive(:file_write).with(path, content)
|
||||||
writer.apply
|
writer.apply
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user