vagrant-lxc-ng/spec/unit/machine_state_spec.rb

40 lines
1 KiB
Ruby
Raw Normal View History

require 'unit_helper'
2013-03-01 03:34:51 +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) }
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') }
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')
end
end
context 'when state id is :running' do
2013-03-01 03:34:51 +00:00
subject { described_class.new(:running) }
it { should be_created }
it { should be_running }
it { should_not be_off }
end
context 'when state id is :stopped' do
subject { described_class.new(:stopped) }
it { should be_created }
it { should be_off }
it { should_not be_running }
end
end