Sha256: c4f7783a98a50d55c1cc6b25f3ea4ff4b22fbbad01bd7eff46fd1904533395b4

Contents?: true

Size: 1.47 KB

Versions: 222

Compression:

Stored size: 1.47 KB

Contents

#! /usr/bin/env ruby
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 = stub 'provider', :class => Puppet::Type.type(:vlan).defaultprovider, :clear => nil
      Puppet::Type.type(:vlan).defaultprovider.stubs(:new).returns(@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

222 entries across 222 versions & 1 rubygems

Version Path
puppet-4.10.6 spec/unit/type/vlan_spec.rb
puppet-4.10.6-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-4.10.6-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-4.10.6-universal-darwin spec/unit/type/vlan_spec.rb
puppet-4.10.5 spec/unit/type/vlan_spec.rb
puppet-4.10.5-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-4.10.5-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-4.10.5-universal-darwin spec/unit/type/vlan_spec.rb
puppet-5.0.1 spec/unit/type/vlan_spec.rb
puppet-5.0.1-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-5.0.1-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-5.0.1-universal-darwin spec/unit/type/vlan_spec.rb
puppet-5.0.0 spec/unit/type/vlan_spec.rb
puppet-5.0.0-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-5.0.0-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-5.0.0-universal-darwin spec/unit/type/vlan_spec.rb
puppet-4.10.4 spec/unit/type/vlan_spec.rb
puppet-4.10.4-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-4.10.4-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-4.10.4-universal-darwin spec/unit/type/vlan_spec.rb