Sha256: ff3524c65815bc266d87cfaaf27f10a02bdded9379a0a963529b7806a28070ff

Contents?: true

Size: 1.4 KB

Versions: 92

Compression:

Stored size: 1.4 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'

describe Puppet::Type.type(:vlan) do

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

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

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

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

  it "should have a description property" do
    Puppet::Type.type(:vlan).attrtype(:description).should == :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
      lambda { Puppet::Type.type(:vlan).new(:name => "notanumber", :ensure => :present) }.should raise_error
    end
  end
end

Version data entries

92 entries across 92 versions & 2 rubygems

Version Path
puppet-3.8.7 spec/unit/type/vlan_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-3.8.6 spec/unit/type/vlan_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-3.8.5 spec/unit/type/vlan_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-3.8.4 spec/unit/type/vlan_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-3.8.3 spec/unit/type/vlan_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-3.8.2 spec/unit/type/vlan_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/type/vlan_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/type/vlan_spec.rb
puppet-3.8.1 spec/unit/type/vlan_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/type/vlan_spec.rb