24 lines
708 B
Ruby
24 lines
708 B
Ruby
require "test_helper"
|
|
|
|
class CommandBaseTest < Test::Unit::TestCase
|
|
setup do
|
|
@klass = Vagrant::Command::Base
|
|
@env = mock_environment
|
|
end
|
|
|
|
context "initialization" do
|
|
should "require an environment" do
|
|
assert_raises(Vagrant::CLIMissingEnvironment) { @klass.new([], {}, {}) }
|
|
assert_nothing_raised { @klass.new([], {}, { :env => @env }) }
|
|
end
|
|
end
|
|
|
|
context "extracting a name from a usage string" do
|
|
should "extract properly" do
|
|
assert_equal "init", @klass.extract_name_from_usage("init")
|
|
assert_equal "init", @klass.extract_name_from_usage("init [foo] [bar]")
|
|
assert_equal "ssh-config", @klass.extract_name_from_usage("ssh-config")
|
|
end
|
|
end
|
|
end
|