Use STOPPED status to identify if machine is off

This commit is contained in:
Fabio Rehm 2013-03-02 00:11:29 -03:00
parent e128b59241
commit 8ca90f1071
3 changed files with 5 additions and 4 deletions

View file

@ -1,7 +1,7 @@
module Vagrant module Vagrant
module LXC module LXC
class MachineState < Vagrant::MachineState class MachineState < Vagrant::MachineState
CREATED_STATES = %w( running poweroff ).map!(&:to_sym) CREATED_STATES = %w( running stopped ).map!(&:to_sym)
def initialize(state_id) def initialize(state_id)
short = state_id.to_s.gsub("_", " ") short = state_id.to_s.gsub("_", " ")
@ -14,7 +14,7 @@ module Vagrant
end end
def off? def off?
self.id == :poweroff self.id == :stopped
end end
def running? def running?

View file

@ -5,6 +5,7 @@ module UnitExampleGroup
Object.any_instance.stub(:system) { |*args, &block| Object.any_instance.stub(:system) { |*args, &block|
UnitExampleGroup.prevent_system_calls(*args, &block) UnitExampleGroup.prevent_system_calls(*args, &block)
} }
require 'vagrant/util/subprocess'
Vagrant::Util::Subprocess.stub(:execute) { |*args, &block| Vagrant::Util::Subprocess.stub(:execute) { |*args, &block|
UnitExampleGroup.prevent_system_calls(*args, &block) UnitExampleGroup.prevent_system_calls(*args, &block)
} }

View file

@ -29,8 +29,8 @@ describe Vagrant::LXC::MachineState do
it { should_not be_off } it { should_not be_off }
end end
context 'when state id is :poweroff' do context 'when state id is :stopped' do
subject { described_class.new(:poweroff) } subject { described_class.new(:stopped) }
it { should be_created } it { should be_created }
it { should be_off } it { should be_off }