Sha256: 9cd9ee8ffa45dc457cfd1c059e7e6453689d9589eac1f47e6b708b3b4b2090ce

Contents?: true

Size: 890 Bytes

Versions: 349

Compression:

Stored size: 890 Bytes

Contents

require 'spec_helper'

require 'puppet/settings'

describe Puppet::Settings::EnumSetting do
  it "allows a configured value" do
    setting = enum_setting_allowing("allowed")

    expect(setting.munge("allowed")).to eq("allowed")
  end

  it "disallows a value that is not configured" do
    setting = enum_setting_allowing("allowed", "also allowed")

    expect do
      setting.munge("disallowed")
    end.to raise_error(Puppet::Settings::ValidationError,
                       "Invalid value 'disallowed' for parameter testing. Allowed values are 'allowed', 'also allowed'")
  end

  def enum_setting_allowing(*values)
    Puppet::Settings::EnumSetting.new(:settings => mock('settings'),
                                      :name => "testing",
                                      :desc => "description of testing",
                                      :values => values)
  end
end

Version data entries

349 entries across 349 versions & 1 rubygems

Version Path
puppet-3.8.2-x64-mingw32 spec/unit/settings/enum_setting_spec.rb
puppet-4.2.1 spec/unit/settings/enum_setting_spec.rb
puppet-4.2.1-x86-mingw32 spec/unit/settings/enum_setting_spec.rb
puppet-4.2.1-x64-mingw32 spec/unit/settings/enum_setting_spec.rb
puppet-4.2.0 spec/unit/settings/enum_setting_spec.rb
puppet-4.2.0-x86-mingw32 spec/unit/settings/enum_setting_spec.rb
puppet-4.2.0-x64-mingw32 spec/unit/settings/enum_setting_spec.rb
puppet-3.8.1 spec/unit/settings/enum_setting_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/settings/enum_setting_spec.rb
puppet-3.8.1-x64-mingw32 spec/unit/settings/enum_setting_spec.rb
puppet-4.1.0 spec/unit/settings/enum_setting_spec.rb
puppet-4.1.0-x86-mingw32 spec/unit/settings/enum_setting_spec.rb
puppet-4.1.0-x64-mingw32 spec/unit/settings/enum_setting_spec.rb
puppet-4.0.0 spec/unit/settings/enum_setting_spec.rb
puppet-4.0.0-x86-mingw32 spec/unit/settings/enum_setting_spec.rb
puppet-4.0.0-x64-mingw32 spec/unit/settings/enum_setting_spec.rb
puppet-3.7.5 spec/unit/settings/enum_setting_spec.rb
puppet-3.7.5-x86-mingw32 spec/unit/settings/enum_setting_spec.rb
puppet-3.7.5-x64-mingw32 spec/unit/settings/enum_setting_spec.rb
puppet-4.0.0.rc1 spec/unit/settings/enum_setting_spec.rb