2013-02-28 03:12:34 +00:00
|
|
|
require 'unit_helper'
|
2013-03-01 03:34:51 +00:00
|
|
|
|
2013-02-28 03:12:34 +00:00
|
|
|
require 'vagrant-lxc/machine_state'
|
|
|
|
|
|
|
|
describe Vagrant::LXC::MachineState do
|
|
|
|
describe 'short description' do
|
2013-03-01 03:34:51 +00:00
|
|
|
subject { described_class.new(:not_created) }
|
2013-02-28 03:12:34 +00:00
|
|
|
|
|
|
|
it 'is a humanized version of state id' do
|
|
|
|
subject.short_description.should == 'not created'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'long description' do
|
2013-03-01 03:34:51 +00:00
|
|
|
subject { described_class.new(:short_name) }
|
|
|
|
before { I18n.stub(t: 'some really long description') }
|
2013-02-28 03:12:34 +00:00
|
|
|
|
|
|
|
it 'is a localized version of the state id' do
|
|
|
|
subject.long_description.should == 'some really long description'
|
2013-03-01 03:34:51 +00:00
|
|
|
I18n.should have_received(:t).with('vagrant.commands.status.short_name')
|
2013-02-28 03:12:34 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when state id is :running' do
|
2013-03-01 03:34:51 +00:00
|
|
|
subject { described_class.new(:running) }
|
2013-02-28 03:12:34 +00:00
|
|
|
|
|
|
|
it { should be_created }
|
|
|
|
it { should be_running }
|
|
|
|
it { should_not be_off }
|
|
|
|
end
|
|
|
|
|
2013-03-02 03:11:29 +00:00
|
|
|
context 'when state id is :stopped' do
|
|
|
|
subject { described_class.new(:stopped) }
|
2013-02-28 03:12:34 +00:00
|
|
|
|
|
|
|
it { should be_created }
|
|
|
|
it { should be_off }
|
|
|
|
it { should_not be_running }
|
|
|
|
end
|
|
|
|
end
|