Simplify Remote#environment spec

This commit is contained in:
Thibault Jouan 2014-01-20 00:00:24 +00:00
parent b6ec8ed468
commit f44fd56158

View File

@ -116,26 +116,14 @@ module Producer::Core
end end
end end
describe '#environment', :ssh do describe '#environment' do
let(:command) { 'env' } let(:command) { 'env' }
let(:output) { "FOO=bar\nBAZ=qux" } let(:output) { 'FOO=bar' }
before do before { allow(remote).to receive(:execute) { output } }
story_with_new_channel do |ch|
ch.sends_exec command
ch.gets_data output
end
end
it 'builds a remote environment with the result of `env` command' do it 'returns a remote environment' do
expect(Remote::Environment).to receive(:new_from_string).with(output) expect(remote.environment['FOO']).to eq 'bar'
remote.environment
end
it 'returns the environment' do
environment = double 'environment'
allow(Remote::Environment).to receive(:new_from_string) { environment }
expect(remote.environment).to be environment
end end
end end
end end