From 8ca90f1071f09d2c3a0ca755082a427bbb593aa3 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Sat, 2 Mar 2013 00:11:29 -0300 Subject: [PATCH] Use STOPPED status to identify if machine is off --- lib/vagrant-lxc/machine_state.rb | 4 ++-- spec/support/unit_example_group.rb | 1 + spec/unit/machine_state_spec.rb | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/vagrant-lxc/machine_state.rb b/lib/vagrant-lxc/machine_state.rb index a3bbc0d..cbc8361 100644 --- a/lib/vagrant-lxc/machine_state.rb +++ b/lib/vagrant-lxc/machine_state.rb @@ -1,7 +1,7 @@ module Vagrant module LXC class MachineState < Vagrant::MachineState - CREATED_STATES = %w( running poweroff ).map!(&:to_sym) + CREATED_STATES = %w( running stopped ).map!(&:to_sym) def initialize(state_id) short = state_id.to_s.gsub("_", " ") @@ -14,7 +14,7 @@ module Vagrant end def off? - self.id == :poweroff + self.id == :stopped end def running? diff --git a/spec/support/unit_example_group.rb b/spec/support/unit_example_group.rb index 13cd1f2..f6751a3 100644 --- a/spec/support/unit_example_group.rb +++ b/spec/support/unit_example_group.rb @@ -5,6 +5,7 @@ module UnitExampleGroup Object.any_instance.stub(:system) { |*args, &block| UnitExampleGroup.prevent_system_calls(*args, &block) } + require 'vagrant/util/subprocess' Vagrant::Util::Subprocess.stub(:execute) { |*args, &block| UnitExampleGroup.prevent_system_calls(*args, &block) } diff --git a/spec/unit/machine_state_spec.rb b/spec/unit/machine_state_spec.rb index 9865372..e1082b4 100644 --- a/spec/unit/machine_state_spec.rb +++ b/spec/unit/machine_state_spec.rb @@ -29,8 +29,8 @@ describe Vagrant::LXC::MachineState do it { should_not be_off } end - context 'when state id is :poweroff' do - subject { described_class.new(:poweroff) } + context 'when state id is :stopped' do + subject { described_class.new(:stopped) } it { should be_created } it { should be_off }