Sha256: ff33a9c0124aee9808bcbd970ed97392e1bfb8435d173e1f48242beb55805a4d

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 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 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

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-cloudstack-1.2.0 vendor/bundle/bundler/gems/vagrant-c84e05fd063f/test/unit/vagrant/plugin/v2/provider_test.rb