Sha256: 434b6f9c0af918df5a9cebde7736872721a4d62f1ad178710aa3cb8eb5352457

Contents?: true

Size: 1.09 KB

Versions: 14

Compression:

Stored size: 1.09 KB

Contents

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

class AddBoxActionTest < Test::Unit::TestCase
  setup do
    @runner, @vm, @action = mock_action(Vagrant::Actions::Box::Add)
  end

  context "prepare" do
    setup do
      @default_order = [Vagrant::Actions::Box::Download, Vagrant::Actions::Box::Unpackage, Vagrant::Actions::Box::Verify]
      @runner.stubs(:directory).returns("foo")
      File.stubs(:exists?).returns(false)
    end

    def setup_action_expectations
      default_seq = sequence("default_seq")
      @default_order.each do |action|
        @runner.expects(:add_action).with(action).once.in_sequence(default_seq)
      end
    end

    should "setup the proper sequence of actions" do
      setup_action_expectations
      @action.prepare
    end

    should "result in an action exception if the box already exists" do
      File.expects(:exists?).once.returns(true)
      @runner.expects(:name).once.returns('foo')
      @runner.expects(:add_action).never
      assert_raise Vagrant::Actions::ActionException do
        @action.prepare
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
vagrantup-0.4.3.dev test/vagrant/actions/box/add_test.rb
vagrantup-0.4.1 test/vagrant/actions/box/add_test.rb
vagrantup-0.4.0 test/vagrant/actions/box/add_test.rb
vagrantup-0.3.4 test/vagrant/actions/box/add_test.rb
vagrantup-0.3.3 test/vagrant/actions/box/add_test.rb
vagrantup-0.3.2 test/vagrant/actions/box/add_test.rb
vagrantup-0.3.1 test/vagrant/actions/box/add_test.rb
vagrant-0.4.2 test/vagrant/actions/box/add_test.rb
vagrant-0.4.1 test/vagrant/actions/box/add_test.rb
vagrant-0.4.0 test/vagrant/actions/box/add_test.rb
vagrant-0.3.4 test/vagrant/actions/box/add_test.rb
vagrant-0.3.3 test/vagrant/actions/box/add_test.rb
vagrant-0.3.2 test/vagrant/actions/box/add_test.rb
vagrant-0.3.1 test/vagrant/actions/box/add_test.rb