Sha256: 9101036269975e3b179ad56bf8cc5e629d5b8a554f773c667633b83fab13e960

Contents?: true

Size: 1.32 KB

Versions: 17

Compression:

Stored size: 1.32 KB

Contents

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

describe Vagrant::Plugin::V2::Provider do
  include_context "unit"

  let(:machine)  { Object.new }
  let(:instance) { described_class.new(machine) }

  subject { instance }

  it "should be usable by default" do
    expect(described_class).to be_usable
  end

  it "should be installed by default" do
    expect(described_class).to be_installed
  end

  it "should return nil by default for actions" do
    expect(instance.action(:whatever)).to be_nil
  end

  it "should return nil by default for ssh info" do
    expect(instance.ssh_info).to be_nil
  end

  it "should return nil by default for state" do
    expect(instance.state).to be_nil
  end

  context "capabilities" do
    before do
      register_plugin("2") do |p|
        p.provider_capability("bar", "foo") {}

        p.provider_capability("foo", "bar") do
          Class.new do
            def self.bar(machine)
              raise "bar #{machine.id}"
            end
          end
        end
      end

      machine.stub(id: "YEAH")

      instance._initialize("foo", machine)
    end

    it "can execute capabilities" do
      expect(subject.capability?(:foo)).to be_false
      expect(subject.capability?(:bar)).to be_true

      expect { subject.capability(:bar) }.
        to raise_error("bar YEAH")
    end
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
vagrant-unbundled-1.9.7.1 test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-aws-mkubenka-0.7.2.pre.14 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-aws-mkubenka-0.7.2.pre.11 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-aws-mkubenka-0.7.2.pre.10 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-aws-mkubenka-0.7.2.pre.9 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-unbundled-1.9.5.1 test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-unbundled-1.9.1.1 test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-unbundled-1.8.5.2 test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-unbundled-1.8.5.1 test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-unbundled-1.8.4.2 test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-unbundled-1.8.4.1 test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-unbundled-1.8.1.2 test/unit/vagrant/plugin/v2/provider_test.rb
vagrant-unbundled-1.8.1.1 test/unit/vagrant/plugin/v2/provider_test.rb