From 80d54bb261499d3121108c2fc17bc6ea7ffddea9 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Thu, 24 Jul 2014 21:57:35 -0300 Subject: [PATCH] Fix the build --- spec/unit/driver/cli_spec.rb | 42 +----------------------------------- spec/unit/driver_spec.rb | 15 ++++--------- 2 files changed, 5 insertions(+), 52 deletions(-) diff --git a/spec/unit/driver/cli_spec.rb b/spec/unit/driver/cli_spec.rb index 0594b35..7ddd66b 100644 --- a/spec/unit/driver/cli_spec.rb +++ b/spec/unit/driver/cli_spec.rb @@ -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) } diff --git a/spec/unit/driver_spec.rb b/spec/unit/driver_spec.rb index c3f0b6f..6bab0cc 100644 --- a/spec/unit/driver_spec.rb +++ b/spec/unit/driver_spec.rb @@ -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