Sha256: 6552eaaa5190a3461085cf64602854d0bacace802306d48f9ee54d244638cef6

Contents?: true

Size: 1.14 KB

Versions: 22

Compression:

Stored size: 1.14 KB

Contents

require "pathname"
require "tmpdir"

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

describe Vagrant::Action::Builtin::IsState do
  let(:app) { lambda { |env| } }
  let(:env) { { machine: machine } }
  let(:machine) do
    double("machine").tap do |machine|
      allow(machine).to receive(:state).and_return(state)
    end
  end

  let(:state) { double("state") }

  describe "#call" do
    it "sets result to false if is proper state" do
      state.stub(id: :foo)

      subject = described_class.new(app, env, :bar)

      expect(app).to receive(:call).with(env)

      subject.call(env)
      expect(env[:result]).to be_false
    end

    it "sets result to true if is proper state" do
      state.stub(id: :foo)

      subject = described_class.new(app, env, :foo)

      expect(app).to receive(:call).with(env)

      subject.call(env)
      expect(env[:result]).to be_true
    end

    it "inverts the result if specified" do
      state.stub(id: :foo)

      subject = described_class.new(app, env, :foo, invert: true)

      expect(app).to receive(:call).with(env)

      subject.call(env)
      expect(env[:result]).to be_false
    end
  end
end

Version data entries

22 entries across 19 versions & 5 rubygems

Version Path
vagrant-unbundled-1.9.7.1 test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-aws-mkubenka-0.7.2.pre.14 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-aws-mkubenka-0.7.2.pre.11 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-aws-mkubenka-0.7.2.pre.10 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-aws-mkubenka-0.7.2.pre.9 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-unbundled-1.9.5.1 test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-unbundled-1.9.1.1 test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-unbundled-1.8.5.2 test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-unbundled-1.8.5.1 test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-unbundled-1.8.4.2 test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-unbundled-1.8.4.1 test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-unbundled-1.8.1.2 test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-unbundled-1.8.1.1 test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/test/unit/vagrant/action/builtin/is_state_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/test/unit/vagrant/action/builtin/is_state_test.rb