Moving unit tests to test/unit
This commit is contained in:
parent
f6e6d7e834
commit
ce5d989384
4
Rakefile
4
Rakefile
|
@ -6,6 +6,6 @@ Bundler::GemHelper.install_tasks
|
|||
task :default => :test
|
||||
|
||||
Rake::TestTask.new do |t|
|
||||
t.libs << "test"
|
||||
t.pattern = 'test/**/*_test.rb'
|
||||
t.libs << "test/unit"
|
||||
t.pattern = 'test/unit/**/*_test.rb'
|
||||
end
|
||||
|
|
|
@ -27,6 +27,7 @@ class ForwardPortsHelpersVMActionTest < Test::Unit::TestCase
|
|||
def mock_vm(options={})
|
||||
options = {
|
||||
:running? => true,
|
||||
:accessible? => true,
|
||||
:uuid => :foo
|
||||
}.merge(options)
|
||||
|
||||
|
@ -50,6 +51,12 @@ class ForwardPortsHelpersVMActionTest < Test::Unit::TestCase
|
|||
@instance.used_ports
|
||||
end
|
||||
|
||||
should "ignore VMs which aren't accessible" do
|
||||
@vms << mock_vm(:accessible? => false)
|
||||
@vms[0].expects(:forwarded_ports).never
|
||||
@instance.used_ports
|
||||
end
|
||||
|
||||
should "ignore VMs of the same uuid" do
|
||||
@vms << mock_vm(:uuid => @vm.uuid)
|
||||
@vms[0].expects(:forwarded_ports).never
|
|
@ -262,6 +262,7 @@ class VMTest < Test::Unit::TestCase
|
|||
setup do
|
||||
@mock_vm.stubs(:running?).returns(false)
|
||||
@mock_vm.stubs(:saved?).returns(false)
|
||||
@mock_vm.stubs(:accessible?).returns(true)
|
||||
end
|
||||
|
||||
should "not do anything if the VM is already running" do
|
||||
|
@ -286,6 +287,14 @@ class VMTest < Test::Unit::TestCase
|
|||
@vm.env.actions.expects(:run).with(:start, :foo => :bar).once
|
||||
@vm.start(:foo => :bar)
|
||||
end
|
||||
|
||||
should "raise an exception if the VM is not accessible" do
|
||||
@mock_vm.stubs(:accessible?).returns(false)
|
||||
|
||||
assert_raises(Vagrant::Errors::VMInaccessible) {
|
||||
@vm.start
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue