Sha256: 6c590052ef47322442b4af0346154d23178bc48fbf86a876012e14ba49d5620d

Contents?: true

Size: 1.26 KB

Versions: 16

Compression:

Stored size: 1.26 KB

Contents

require File.join(File.dirname(__FILE__), '..', 'test_helper')

class CommandTest < Test::Unit::TestCase
  setup do
    @klass = Vagrant::Command
  end

  context "initializing" do
    setup do
      @env = mock("environment")
    end

    should "set the env attribute" do
      @instance = @klass.new(@env)
      assert_equal @env, @instance.env
    end
  end

  context "class methods" do
    context "executing" do
      should "load the environment then send the command on commands" do
        env = mock("env")
        commands = mock("commands")
        env.stubs(:commands).returns(commands)
        Vagrant::Environment.expects(:load!).returns(env)
        commands.expects(:subcommand).with(1,2,3).once

        @klass.execute(1,2,3)
      end
    end
  end

  context "with an instance" do
    setup do
      @env = mock_environment
      @instance = @klass.new(@env)
    end

    context "subcommands" do
      setup do
        @raw_name = :bar
        @name = :foo
        @instance.stubs(:camelize).with(@raw_name).returns(@name)
      end

      should "send the env, name, and args to the base class" do
        args = [1,2,3]
        Vagrant::Commands::Base.expects(:dispatch).with(@env, @name, *args)
        @instance.subcommand(@name, *args)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
vagrantup-0.4.3.dev test/vagrant/command_test.rb
vagrantup-0.4.1 test/vagrant/command_test.rb
vagrantup-0.4.0 test/vagrant/command_test.rb
vagrantup-0.3.4 test/vagrant/command_test.rb
vagrantup-0.3.3 test/vagrant/command_test.rb
vagrantup-0.3.2 test/vagrant/command_test.rb
vagrantup-0.3.1 test/vagrant/command_test.rb
vagrantup-0.3.0 test/vagrant/command_test.rb
vagrant-0.4.2 test/vagrant/command_test.rb
vagrant-0.4.1 test/vagrant/command_test.rb
vagrant-0.4.0 test/vagrant/command_test.rb
vagrant-0.3.4 test/vagrant/command_test.rb
vagrant-0.3.3 test/vagrant/command_test.rb
vagrant-0.3.2 test/vagrant/command_test.rb
vagrant-0.3.1 test/vagrant/command_test.rb
vagrant-0.3.0 test/vagrant/command_test.rb