Sha256: 46f97a97ba8f698c588cd0875cfad1b45297e93e87d13387e72eee010eefa3e0

Contents?: true

Size: 957 Bytes

Versions: 12

Compression:

Stored size: 957 Bytes

Contents

require 'thread'

require File.expand_path("../../base", __FILE__)

describe Vagrant::BatchAction do
  let(:called_actions) { [] }
  let!(:lock) { Mutex.new }
  let(:provider_name) { "test" }
  let(:provider_options) { {} }

  def new_machine(options)
    double("machine").tap do |m|
      m.stub(:provider_name => provider_name)
      m.stub(:provider_options => options)
      m.stub(:action) do |action, opts|
        lock.synchronize do
          called_actions << [m, action, opts]
        end
      end
    end
  end

  describe "#run" do
    let(:machine) { new_machine(provider_options) }
    let(:machine2) { new_machine(provider_options) }

    it "should run the actions on the machines in order" do
      subject.action(machine, "up")
      subject.action(machine2, "destroy")
      subject.run

      called_actions.include?([machine, "up", nil]).should be
      called_actions.include?([machine2, "destroy", nil]).should be
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/test/unit/vagrant/batch_action_test.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/test/unit/vagrant/batch_action_test.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/test/unit/vagrant/batch_action_test.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/test/unit/vagrant/batch_action_test.rb
tnargav-1.3.6 test/unit/vagrant/batch_action_test.rb
tnargav-1.3.3 test/unit/vagrant/batch_action_test.rb
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/test/unit/vagrant/batch_action_test.rb
tnargav-1.2.3 test/unit/vagrant/batch_action_test.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/test/unit/vagrant/batch_action_test.rb
vagrant-shell-0.2.6 vendor/bundle/gems/tnargav-1.2.2/test/unit/vagrant/batch_action_test.rb
vagrant-shell-0.2.5 vendor/bundle/gems/tnargav-1.2.2/test/unit/vagrant/batch_action_test.rb
tnargav-1.2.2 test/unit/vagrant/batch_action_test.rb