Make remote available to env
This commit is contained in:
@@ -14,6 +14,10 @@ module Producer
|
|||||||
def output(str)
|
def output(str)
|
||||||
@output.puts str
|
@output.puts str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def remote
|
||||||
|
@remote ||= Remote.new(target)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -47,5 +47,23 @@ module Producer::Core
|
|||||||
expect(env.target).to eq target
|
expect(env.target).to eq target
|
||||||
end
|
end
|
||||||
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
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user