Sha256: 3abbeb06960e1aff8f60b1496ccb2962f8b03d0a72d597bcd63a2cb7bb5e0aaa

Contents?: true

Size: 1.47 KB

Versions: 16

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'

describe Puppet::Type.type(:selboolean), "when validating attributes" do
  [:name, :persistent].each do |param|
    it "should have a #{param} parameter" do
      expect(Puppet::Type.type(:selboolean).attrtype(param)).to eq(:param)
    end
  end

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

describe Puppet::Type.type(:selboolean), "when validating values" do
  before do
    @class = Puppet::Type.type(:selboolean)

    @provider_class = double('provider_class', :name => "fake", :suitable? => true, :supports_parameter? => true)
    allow(@class).to receive(:defaultprovider).and_return(@provider_class)
    allow(@class).to receive(:provider).and_return(@provider_class)

    @provider = double('provider', :class => @provider_class, :clear => nil)
    allow(@provider_class).to receive(:new).and_return(@provider)
  end

  it "should support :on as a value to :value" do
    Puppet::Type.type(:selboolean).new(:name => "yay", :value => :on)
  end

  it "should support :off as a value to :value" do
    Puppet::Type.type(:selboolean).new(:name => "yay", :value => :off)
  end

  it "should support :true as a value to :persistent" do
    Puppet::Type.type(:selboolean).new(:name => "yay", :value => :on, :persistent => :true)
  end

  it "should support :false as a value to :persistent" do
    Puppet::Type.type(:selboolean).new(:name => "yay", :value => :on, :persistent => :false)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
puppet-5.5.17-x86-mingw32 spec/unit/type/selboolean_spec.rb
puppet-5.5.17 spec/unit/type/selboolean_spec.rb
puppet-5.5.17-x64-mingw32 spec/unit/type/selboolean_spec.rb
puppet-5.5.17-universal-darwin spec/unit/type/selboolean_spec.rb
puppet-5.5.16 spec/unit/type/selboolean_spec.rb
puppet-5.5.16-x86-mingw32 spec/unit/type/selboolean_spec.rb
puppet-5.5.16-x64-mingw32 spec/unit/type/selboolean_spec.rb
puppet-5.5.16-universal-darwin spec/unit/type/selboolean_spec.rb
puppet-5.5.14 spec/unit/type/selboolean_spec.rb
puppet-5.5.14-x86-mingw32 spec/unit/type/selboolean_spec.rb
puppet-5.5.14-x64-mingw32 spec/unit/type/selboolean_spec.rb
puppet-5.5.14-universal-darwin spec/unit/type/selboolean_spec.rb
puppet-5.5.13 spec/unit/type/selboolean_spec.rb
puppet-5.5.13-x86-mingw32 spec/unit/type/selboolean_spec.rb
puppet-5.5.13-x64-mingw32 spec/unit/type/selboolean_spec.rb
puppet-5.5.13-universal-darwin spec/unit/type/selboolean_spec.rb