From b8e5a9fa1cf02687ca1ab957bb09f1051821a42e Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Sat, 2 Mar 2013 01:34:47 -0300 Subject: [PATCH] lxc-destroy: check --- lib/vagrant-lxc/container.rb | 3 +-- spec/unit/container_spec.rb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/vagrant-lxc/container.rb b/lib/vagrant-lxc/container.rb index f292f90..046fe8f 100644 --- a/lib/vagrant-lxc/container.rb +++ b/lib/vagrant-lxc/container.rb @@ -47,8 +47,7 @@ module Vagrant end def destroy - puts "TODO: Destroy container" - File.delete(state_file_path) if state_file_path + lxc :destroy, '--name', @name end def wait_until(state) diff --git a/spec/unit/container_spec.rb b/spec/unit/container_spec.rb index 86c1dbc..dc6bde8 100644 --- a/spec/unit/container_spec.rb +++ b/spec/unit/container_spec.rb @@ -96,6 +96,22 @@ describe Vagrant::LXC::Container do end end + describe 'destruction' do + let(:name) { 'container-name' } + + before do + subject.stub(lxc: true) + subject.destroy + end + + it 'calls lxc-create with the right arguments' do + subject.should have_received(:lxc).with( + :destroy, + '--name', name, + ) + end + end + describe 'start' do let(:name) { 'container-name' }