Make remote available to env

This commit is contained in:
Thibault Jouan 2013-08-03 22:52:25 +00:00
parent ace5bfb3fa
commit 9875a4ae7b
2 changed files with 22 additions and 0 deletions

View File

@ -14,6 +14,10 @@ module Producer
def output(str)
@output.puts str
end
def remote
@remote ||= Remote.new(target)
end
end
end
end

View File

@ -47,5 +47,23 @@ module Producer::Core
expect(env.target).to eq target
end
end
describe '#remote' do
it 'builds a Remote with the current target' do
env.target = 'some_hostname.example'
expect(Remote).to receive(:new).with(env.target)
env.remote
end
it 'returns the remote' do
remote = double('remote')
allow(Remote).to receive(:new) { remote }
expect(env.remote).to eq remote
end
it 'memoizes the remote' do
expect(env.remote).to be env.remote
end
end
end
end