Sha256: 881646decf19e42b0aae4798840fd4f5f31693a0c161ef2451f8361c5a4263d0

Contents?: true

Size: 1.95 KB

Versions: 35

Compression:

Stored size: 1.95 KB

Contents

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

require 'puppet/type/mcx'

mcx_type = Puppet::Type.type(:mcx)

describe mcx_type, "when validating attributes" do

  properties = [:ensure, :content]
  parameters = [:name, :ds_type, :ds_name]

  parameters.each do |p|
    it "should have a #{p} parameter" do
      mcx_type.attrclass(p).ancestors.should be_include(Puppet::Parameter)
    end
    it "should have documentation for its #{p} parameter" do
      mcx_type.attrclass(p).doc.should be_instance_of(String)
    end
  end

  properties.each do |p|
    it "should have a #{p} property" do
      mcx_type.attrclass(p).ancestors.should be_include(Puppet::Property)
    end
    it "should have documentation for its #{p} property" do
      mcx_type.attrclass(p).doc.should be_instance_of(String)
    end
  end

end

describe mcx_type, "default values" do

  before :each do
    provider_class = mcx_type.provider(mcx_type.providers[0])
    mcx_type.stubs(:defaultprovider).returns provider_class
  end

  it "should be nil for :ds_type" do
    mcx_type.new(:name => '/Foo/bar')[:ds_type].should be_nil
  end

  it "should be nil for :ds_name" do
    mcx_type.new(:name => '/Foo/bar')[:ds_name].should be_nil
  end

  it "should be nil for :content" do
    mcx_type.new(:name => '/Foo/bar')[:content].should be_nil
  end

end

describe mcx_type, "when validating properties" do

  before :each do
    provider_class = mcx_type.provider(mcx_type.providers[0])
    mcx_type.stubs(:defaultprovider).returns provider_class
  end

  it "should be able to create an instance" do
    lambda {
      mcx_type.new(:name => '/Foo/bar')
    }.should_not raise_error
  end

  it "should support :present as a value to :ensure" do
    lambda {
      mcx_type.new(:name => "/Foo/bar", :ensure => :present)
    }.should_not raise_error
  end

  it "should support :absent as a value to :ensure" do
    lambda {
      mcx_type.new(:name => "/Foo/bar", :ensure => :absent)
    }.should_not raise_error
  end

end

Version data entries

35 entries across 35 versions & 3 rubygems

Version Path
puppet-2.7.26 spec/unit/type/mcx_spec.rb
puppet-2.7.25 spec/unit/type/mcx_spec.rb
puppet-2.7.24 spec/unit/type/mcx_spec.rb
puppet-2.7.23 spec/unit/type/mcx_spec.rb
puppet-2.7.22 spec/unit/type/mcx_spec.rb
puppet-2.7.21 spec/unit/type/mcx_spec.rb
puppet-2.7.20 spec/unit/type/mcx_spec.rb
puppet-2.7.20.rc1 spec/unit/type/mcx_spec.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/unit/type/mcx_spec.rb
puppet-2.7.19 spec/unit/type/mcx_spec.rb
supply_drop-0.11.0 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/type/mcx_spec.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/unit/type/mcx_spec.rb
supply_drop-0.10.2 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/type/mcx_spec.rb
puppet-2.7.18 spec/unit/type/mcx_spec.rb
supply_drop-0.10.1 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/type/mcx_spec.rb
supply_drop-0.10.0 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/type/mcx_spec.rb
puppet-2.7.17 spec/unit/type/mcx_spec.rb
puppet-2.7.16 spec/unit/type/mcx_spec.rb
puppet-2.7.14 spec/unit/type/mcx_spec.rb
puppet-2.7.13 spec/unit/type/mcx_spec.rb