Implement Action#remote (delegates to env.remote)

This commit is contained in:
Thibault Jouan
2014-01-09 00:42:34 +00:00
parent e567c61e4e
commit 29c26ab961
6 changed files with 20 additions and 15 deletions

View File

@@ -8,8 +8,8 @@ module Producer::Core
subject(:writer) { Actions::FileWriter.new(env, path, content) }
describe '#apply' do
it 'delegates the call to env.remote.fs.file_write method' do
expect(env.remote.fs).to receive(:file_write).with(path, content)
it 'writes the content to remote file' do
expect(writer.remote.fs).to receive(:file_write).with(path, content)
writer.apply
end
end

View File

@@ -8,17 +8,15 @@ module Producer::Core
subject(:sh) { Actions::ShellCommand.new(env, command) }
describe '#apply' do
before { env.output = StringIO.new }
it 'delegates the call to env.remote.execute method' do
expect(env.remote).to receive(:execute).with(command)
it 'executes the remote command' do
expect(sh.remote).to receive(:execute).with(command)
sh.apply
end
it 'writes the returned output to env.output with a record separator' do
allow(env.remote).to receive(:execute) { command_args }
it 'writes the returned output with a record separator' do
allow(sh.remote).to receive(:execute) { command_args }
sh.apply
expect(env.output.string).to eq "#{command_args}\n"
expect(sh.output.string).to eq "#{command_args}\n"
end
end
end