Fix the build

This commit is contained in:
Fabio Rehm 2014-07-24 21:57:35 -03:00
parent aac8c31410
commit 80d54bb261
2 changed files with 5 additions and 52 deletions

View file

@ -4,7 +4,7 @@ require 'vagrant-lxc/sudo_wrapper'
require 'vagrant-lxc/driver/cli'
describe Vagrant::LXC::Driver::CLI do
let(:sudo_wrapper) { double(Vagrant::LXC::SudoWrapper, run: true) }
let(:sudo_wrapper) { double(Vagrant::LXC::SudoWrapper, run: true, wrapper_path: nil) }
subject { described_class.new(sudo_wrapper) }
@ -110,26 +110,6 @@ describe Vagrant::LXC::Driver::CLI do
end
end
describe 'shutdown' do
let(:name) { 'a-running-container' }
subject { described_class.new(sudo_wrapper, name) }
before do
subject.stub(system: true)
allow(subject).to receive(:run)
end
it 'issues a lxc-shutdown with provided container name' do
subject.shutdown
expect(subject).to have_received(:run).with(:shutdown, '--name', name)
end
it 'raises a ShutdownNotSupported in case it is not supported' do
allow(subject).to receive(:system).with('which lxc-shutdown > /dev/null').and_return(false)
expect { subject.shutdown }.to raise_error(described_class::ShutdownNotSupported)
end
end
describe 'stop' do
let(:name) { 'a-running-container' }
subject { described_class.new(sudo_wrapper, name) }
@ -169,26 +149,6 @@ describe Vagrant::LXC::Driver::CLI do
end
end
describe 'shutdown' do
let(:name) { 'a-running-container' }
subject { described_class.new(sudo_wrapper, name) }
before do
subject.stub(system: true)
allow(subject).to receive(:run)
end
it 'issues a lxc-shutdown with provided container name' do
subject.shutdown
expect(subject).to have_received(:run).with(:shutdown, '--name', name)
end
it 'raises a ShutdownNotSupported in case it is not supported' do
allow(subject).to receive(:system).with('which lxc-shutdown > /dev/null').and_return(false)
expect { subject.shutdown }.to raise_error(described_class::ShutdownNotSupported)
end
end
describe 'state' do
let(:name) { 'a-container' }
subject { described_class.new(sudo_wrapper, name) }

View file

@ -113,7 +113,7 @@ describe Vagrant::LXC::Driver do
end
describe 'halt' do
let(:cli) { double(Vagrant::LXC::Driver::CLI, shutdown: true) }
let(:cli) { double(Vagrant::LXC::Driver::CLI, stop: true) }
subject { described_class.new('name', nil, cli) }
@ -121,8 +121,8 @@ describe Vagrant::LXC::Driver do
allow(cli).to receive(:transition_to).and_yield(cli)
end
it 'delegates to cli shutdown' do
expect(cli).to receive(:shutdown)
it 'delegates to cli stop' do
expect(cli).to receive(:stop)
subject.forced_halt
end
@ -133,14 +133,7 @@ describe Vagrant::LXC::Driver do
it 'attempts to force the container to stop in case a shutdown doesnt work' do
allow(cli).to receive(:shutdown).and_raise(Vagrant::LXC::Driver::CLI::TargetStateNotReached.new :target, :source)
expect(cli).to receive(:transition_to).with(:stopped).twice
expect(cli).to receive(:stop)
subject.forced_halt
end
it 'attempts to force the container to stop in case lxc-shutdown is not supported' do
allow(cli).to receive(:shutdown).and_raise(Vagrant::LXC::Driver::CLI::ShutdownNotSupported)
expect(cli).to receive(:transition_to).with(:stopped).twice
expect(cli).to receive(:transition_to).with(:stopped)
expect(cli).to receive(:stop)
subject.forced_halt
end