Remove some unused args and add pending specs so that we don't forget to test it

This commit is contained in:
Fabio Rehm 2013-07-31 22:35:49 -03:00
parent c4429fa158
commit 2082a5a81d
4 changed files with 11 additions and 17 deletions

View file

@ -76,7 +76,7 @@ module Vagrant
prune_customizations prune_customizations
write_customizations(customizations + @customizations) write_customizations(customizations + @customizations)
@cli.transition_to(:running) { |c| c.start([], (extra || nil)) } @cli.transition_to(:running) { |c| c.start(extra) }
end end
def forced_halt def forced_halt
@ -124,8 +124,7 @@ module Vagrant
end end
def prune_customizations def prune_customizations
# Use sed to just strip out the block of code which was inserted # Use sed to just strip out the block of code which was inserted by Vagrant
# by Vagrant
@logger.debug 'Prunning vagrant-lxc customizations' @logger.debug 'Prunning vagrant-lxc customizations'
@sudo_wrapper.su_c("sed -e '/^# VAGRANT-BEGIN/,/^# VAGRANT-END/ d' -ibak #{base_path.join('config')}") @sudo_wrapper.su_c("sed -e '/^# VAGRANT-BEGIN/,/^# VAGRANT-END/ d' -ibak #{base_path.join('config')}")
end end

View file

@ -63,10 +63,8 @@ module Vagrant
run :destroy, '--name', @name run :destroy, '--name', @name
end end
def start(overrides = [], extra_opts = []) def start(options = [])
options = [] run :start, '-d', '--name', @name, *Array(options)
options += extra_opts if extra_opts
run :start, '-d', '--name', @name, *options
end end
def stop def stop

View file

@ -96,14 +96,6 @@ describe Vagrant::LXC::Driver::CLI do
'--name', name '--name', name
) )
end end
it 'uses provided array to override container configs' do
subject.start([['config', 'value'], ['other', 'value']])
subject.should have_received(:run).with(:start, '-d', '--name', name,
'-s', "lxc.config='value'",
'-s', "lxc.other='value'"
)
end
end end
describe 'shutdown' do describe 'shutdown' do

View file

@ -75,8 +75,9 @@ describe Vagrant::LXC::Driver do
let(:customizations) { [['a', '1'], ['b', '2']] } let(:customizations) { [['a', '1'], ['b', '2']] }
let(:internal_customization) { ['internal', 'customization'] } let(:internal_customization) { ['internal', 'customization'] }
let(:cli) { instance_double('Vagrant::LXC::Driver::CLI', start: true) } let(:cli) { instance_double('Vagrant::LXC::Driver::CLI', start: true) }
let(:sudo) { instance_double('Vagrant::LXC::SudoWrapper', su_c: true) }
subject { described_class.new('name', nil, cli) } subject { described_class.new('name', sudo, cli) }
before do before do
cli.stub(:transition_to).and_yield(cli) cli.stub(:transition_to).and_yield(cli)
@ -84,8 +85,12 @@ describe Vagrant::LXC::Driver do
subject.start(customizations) subject.start(customizations)
end end
it 'prunes previous customizations before writing'
it 'writes configurations to config file'
it 'starts container with configured customizations' do it 'starts container with configured customizations' do
cli.should have_received(:start).with(customizations + [internal_customization], nil) cli.should have_received(:start)
end end
it 'expects a transition to running state to take place' do it 'expects a transition to running state to take place' do