Sha256: 96e50f57097f1aa5f76ae65f718a059d08e7ec7c5e8678ec866026bd0db1ff42

Contents?: true

Size: 1.47 KB

Versions: 36

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'

describe Puppet::Type.type(:vlan) do
  it "should have a 'name' parameter'" do
    expect(Puppet::Type.type(:vlan).new(:name => "200")[:name]).to eq("200")
  end

  it "should have a 'device_url' parameter'" do
    expect(Puppet::Type.type(:vlan).new(:name => "200", :device_url => :device)[:device_url]).to eq(:device)
  end

  it "should be applied on device" do
    expect(Puppet::Type.type(:vlan).new(:name => "200")).to be_appliable_to_device
  end

  it "should have an ensure property" do
    expect(Puppet::Type.type(:vlan).attrtype(:ensure)).to eq(:property)
  end

  it "should have a description property" do
    expect(Puppet::Type.type(:vlan).attrtype(:description)).to eq(:property)
  end

  describe "when validating attribute values" do
    before do
      @provider = double('provider', :class => Puppet::Type.type(:vlan).defaultprovider, :clear => nil)
      allow(Puppet::Type.type(:vlan).defaultprovider).to receive(:new).and_return(@provider)
    end

    it "should support :present as a value to :ensure" do
      Puppet::Type.type(:vlan).new(:name => "200", :ensure => :present)
    end

    it "should support :absent as a value to :ensure" do
      Puppet::Type.type(:vlan).new(:name => "200", :ensure => :absent)
    end

    it "should fail if vlan name is not a number" do
      expect { Puppet::Type.type(:vlan).new(:name => "notanumber", :ensure => :present) }.to raise_error(Puppet::ResourceError, /Parameter name failed on Vlan/)
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
puppet-5.5.22 spec/unit/type/vlan_spec.rb
puppet-5.5.22-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-5.5.22-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-5.5.22-universal-darwin spec/unit/type/vlan_spec.rb
puppet-5.5.21 spec/unit/type/vlan_spec.rb
puppet-5.5.21-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-5.5.21-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-5.5.21-universal-darwin spec/unit/type/vlan_spec.rb
puppet-5.5.20 spec/unit/type/vlan_spec.rb
puppet-5.5.20-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-5.5.20-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-5.5.20-universal-darwin spec/unit/type/vlan_spec.rb
puppet-5.5.19 spec/unit/type/vlan_spec.rb
puppet-5.5.19-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-5.5.19-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-5.5.19-universal-darwin spec/unit/type/vlan_spec.rb
puppet-5.5.18 spec/unit/type/vlan_spec.rb
puppet-5.5.18-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-5.5.18-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-5.5.18-universal-darwin spec/unit/type/vlan_spec.rb