#157: small refactoring, updated specs
This commit is contained in:
parent
c5a89a54ce
commit
39515cc1da
2 changed files with 5 additions and 7 deletions
|
@ -58,13 +58,11 @@ module Vagrant
|
||||||
|
|
||||||
# Return the output, making sure to replace any Windows-style
|
# Return the output, making sure to replace any Windows-style
|
||||||
# newlines with Unix-style.
|
# newlines with Unix-style.
|
||||||
|
stdout = r.stdout.gsub("\r\n", "\n")
|
||||||
if opts[:show_stderr]
|
if opts[:show_stderr]
|
||||||
{
|
{ :stdout => stdout, :stderr => r.stderr.gsub("\r\n", "\n") }
|
||||||
:stdout => r.stdout.gsub("\r\n", "\n"),
|
|
||||||
:stderr => r.stderr.gsub("\r\n", "\n")
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
r.stdout.gsub("\r\n", "\n")
|
stdout
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -146,13 +146,13 @@ describe Vagrant::LXC::Driver::CLI do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'supports a "namespaces" parameter' do
|
it 'supports a "namespaces" parameter' do
|
||||||
subject.stub(:run).with(:attach, '-h', '2>&1').and_return('--namespaces')
|
subject.stub(:run).with(:attach, '-h', :show_stderr => true).and_return({:stdout => '', :stderr => '--namespaces'})
|
||||||
subject.attach *(command + [{namespaces: ['network', 'mount']}])
|
subject.attach *(command + [{namespaces: ['network', 'mount']}])
|
||||||
subject.should have_received(:run).with(:attach, '--name', name, '--namespaces', 'NETWORK|MOUNT', '--', *command)
|
subject.should have_received(:run).with(:attach, '--name', name, '--namespaces', 'NETWORK|MOUNT', '--', *command)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'raises a NamespacesNotSupported error if not supported' do
|
it 'raises a NamespacesNotSupported error if not supported' do
|
||||||
subject.stub(:run).with(:attach, '-h', '2>&1').and_return('not supported')
|
subject.stub(:run).with(:attach, '-h', :show_stderr => true).and_return({:stdout => '', :stderr => 'not supported'})
|
||||||
expect {
|
expect {
|
||||||
subject.attach *(command + [{namespaces: ['network', 'mount']}])
|
subject.attach *(command + [{namespaces: ['network', 'mount']}])
|
||||||
}.to raise_error(Vagrant::LXC::Errors::NamespacesNotSupported)
|
}.to raise_error(Vagrant::LXC::Errors::NamespacesNotSupported)
|
||||||
|
|
Loading…
Reference in a new issue