Skip to content

Commit

Permalink
remove ensure_vm_exists command helper as it's no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
thbishop committed Oct 20, 2011
1 parent 74849fe commit f59fbb3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 41 deletions.
18 changes: 0 additions & 18 deletions lib/fission/command_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
module Fission
module CommandHelpers

# Public: Checks for the existence of a VM.
#
# vm - Fission VM object to look for.
#
# Examples
#
# ensure_vm_exists 'foo'
#
# Returns nothing.
# If the VM does not exist, then an error will be output and it will exit
# with an exit code of 1.
# If the VM exists, nothing will be output.
def ensure_vm_exists(vm)
unless vm.exists?
output_and_exit "Unable to find the VM '#{vm.name}' (#{VM.path(vm.name)})", 1
end
end

end
end
23 changes: 0 additions & 23 deletions spec/fission/command_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,4 @@
@object.extend Fission::CommandHelpers
end

describe 'ensure_vm_exists' do
before do
@vm_mock.stub(:name).and_return('foo')
end

it 'should output and exit if the VM does not exist' do
@vm_mock.should_receive(:exists?).and_return(false)
@object.should_receive(:output_and_exit).
with("Unable to find the VM 'foo' (#{Fission::VM.path('foo')})", 1)

@object.ensure_vm_exists @vm_mock
end

it 'should do nothing if the VM exists' do
@vm_mock.should_receive(:exists?).and_return(true)
@object.should_not_receive(:output_and_exit)
@object.should_not_receive(:output)

@object.ensure_vm_exists @vm_mock
end

end

end

0 comments on commit f59fbb3

Please sign in to comment.