Fix broken specs

This commit is contained in:
Fabio Rehm 2014-05-04 20:50:04 -03:00
parent 856a847bc8
commit b17fb7baa8
2 changed files with 22 additions and 14 deletions

View file

@ -43,6 +43,8 @@ describe Vagrant::LXC::Driver::CLI do
describe 'create' do
let(:template) { 'quantal-64' }
let(:name) { 'quantal-container' }
let(:backingstore) { 'btrfs' }
let(:backingstore_opts) { [['--dir', '/tmp/foo'], ['--foo', 'bar']] }
let(:config_file) { 'config' }
let(:template_args) { { '--extra-param' => 'param', '--other' => 'value' } }
@ -53,9 +55,11 @@ describe Vagrant::LXC::Driver::CLI do
end
it 'issues a lxc-create with provided template, container name and hash of arguments' do
subject.create(template, config_file, template_args)
subject.create(template, backingstore, backingstore_opts, config_file, template_args)
expect(subject).to have_received(:run).with(
:create,
'-B', backingstore,
*(backingstore_opts.flatten),
'--template', template,
'--name', name,
'-f', config_file,
@ -68,7 +72,7 @@ describe Vagrant::LXC::Driver::CLI do
it 'wraps a low level error into something more meaningful in case the container already exists' do
allow(subject).to receive(:run) { raise Vagrant::LXC::Errors::ExecuteError, stderr: 'alreAdy Exists' }
expect {
subject.create(template, config_file, template_args)
subject.create(template, backingstore, backingstore_opts, config_file, template_args)
}.to raise_error(Vagrant::LXC::Errors::ContainerAlreadyExists)
end
end

View file

@ -32,6 +32,8 @@ describe Vagrant::LXC::Driver do
describe 'creation' do
let(:name) { 'container-name' }
let(:backingstore) { 'btrfs' }
let(:backingstore_opts) { [['--dir', '/tmp/foo'], ['--foo', 'bar']] }
let(:template_name) { 'auto-assigned-template-id' }
let(:template_path) { '/path/to/lxc-template-from-box' }
let(:template_opts) { {'--some' => 'random-option'} }
@ -43,7 +45,7 @@ describe Vagrant::LXC::Driver do
before do
allow(subject).to receive(:import_template).and_yield(template_name)
subject.create name, template_path, config_file, template_opts
subject.create name, backingstore, backingstore_opts, template_path, config_file, template_opts
end
it 'sets the cli object container name' do
@ -53,6 +55,8 @@ describe Vagrant::LXC::Driver do
it 'creates container with the right arguments' do
expect(cli).to have_received(:create).with(
template_name,
backingstore,
backingstore_opts,
config_file,
template_opts
)