Sha256: b71a6d42c9d734036c8dbf4a7d81ac5ad2f1c6aca4e436e4d2344347e0361794

Contents?: true

Size: 986 Bytes

Versions: 6

Compression:

Stored size: 986 Bytes

Contents

require 'spec_helper'
require 'chef_metal_fog/fog_driver'

describe ChefMetalFog::FogDriver do

  describe ".from_url" do
    subject { ChefMetalFog::FogDriver.from_provider('TestDriver', {}) }

    it "should return the correct class" do
      expect(subject).to be_an_instance_of ChefMetalFog::Providers::TestDriver
    end

    it "should call the target compute_options_for" do
      expect(ChefMetalFog::Providers::TestDriver).to receive(:compute_options_for)
        .with('TestDriver', anything, {}).and_return([{}, 'test']).twice
      subject
    end

  end

  describe "when creating a new class" do
    it "should return the correct class" do
      test = ChefMetalFog::FogDriver.new('fog:TestDriver:foo', {})
      expect(test).to be_an_instance_of ChefMetalFog::Providers::TestDriver
    end

    it "should populate config" do
      test = ChefMetalFog::FogDriver.new('fog:TestDriver:foo', {test: "metal"})
      expect(test.config[:test]).to eq "metal"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
chef-metal-fog-0.9 spec/unit/fog_driver_spec.rb
chef-metal-fog-0.8 spec/unit/fog_driver_spec.rb
chef-metal-fog-0.7.1 spec/unit/fog_driver_spec.rb
chef-metal-fog-0.7 spec/unit/fog_driver_spec.rb
chef-metal-fog-0.6.1 spec/unit/fog_driver_spec.rb
chef-metal-fog-0.6 spec/unit/fog_driver_spec.rb