repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/ssl/verifier_spec.rb | spec/unit/ssl/verifier_spec.rb | require 'spec_helper'
describe Puppet::SSL::Verifier do
let(:options) { {} }
let(:ssl_context) { Puppet::SSL::SSLContext.new(options) }
let(:host) { 'example.com' }
let(:http) { Net::HTTP.new(host) }
let(:verifier) { described_class.new(host, ssl_context) }
context '#reusable?' do
it 'Verifiers with t... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/ssl/certificate_signer_spec.rb | spec/unit/ssl/certificate_signer_spec.rb | require 'spec_helper'
describe Puppet::SSL::CertificateSigner do
include PuppetSpec::Files
let(:wrong_key) { OpenSSL::PKey::RSA.new(512) }
let(:client_cert) { cert_fixture('signed.pem') }
# jruby-openssl >= 0.13.0 (JRuby >= 9.3.5.0) raises an error when signing a
# certificate when there is a discrepancy b... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/gettext/module_loading_spec.rb | spec/unit/gettext/module_loading_spec.rb | require 'spec_helper'
require 'puppet_spec/modules'
require 'puppet_spec/files'
require 'puppet/gettext/module_translations'
describe Puppet::ModuleTranslations do
include PuppetSpec::Files
describe "loading translations from the module path" do
let(:modpath) { tmpdir('modpath') }
let(:module_a) { Puppe... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/gettext/config_spec.rb | spec/unit/gettext/config_spec.rb | require 'puppet/gettext/config'
require 'spec_helper'
describe Puppet::GettextConfig do
require 'puppet_spec/files'
include PuppetSpec::Files
include Puppet::GettextConfig
let(:local_path) do
local_path ||= Puppet::GettextConfig::LOCAL_PATH
end
let(:windows_path) do
windows_path ||= Puppet::Gette... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/partition_spec.rb | spec/unit/functions/partition_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the partition function' do
include PuppetSpec::Compiler
include Matchers::Resource
context 'for an array' do
it 'partitions by item' do
manifest = "notify { String(partition(['', b, ab]) |$s| { $s.empty }): }"
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/floor_spec.rb | spec/unit/functions/floor_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the floor function' do
include PuppetSpec::Compiler
include Matchers::Resource
context 'for an integer' do
[ 0, 1, -1].each do |x|
it "called as floor(#{x}) results in the same value" do
expect(compile_... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/step_spec.rb | spec/unit/functions/step_spec.rb | require 'puppet'
require 'spec_helper'
require 'puppet_spec/compiler'
require 'shared_behaviours/iterative_functions'
describe 'the step method' do
include PuppetSpec::Compiler
it 'raises an error when given a type that cannot be iterated' do
expect do
compile_to_catalog(<<-MANIFEST)
3.14.step(... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/break_spec.rb | spec/unit/functions/break_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the break function' do
include PuppetSpec::Compiler
include Matchers::Resource
context do
it 'breaks iteration as if at end of input in a map for an array' do
expect(compile_to_catalog(<<-CODE)).to have_resour... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/min_spec.rb | spec/unit/functions/min_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the min function' do
include PuppetSpec::Compiler
include Matchers::Resource
let(:logs) { [] }
let(:warnings) { logs.select { |log| log.level == :warning }.map { |log| log.message } }
it 'errors if not give at least... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/getvar_spec.rb | spec/unit/functions/getvar_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the getvar function' do
include PuppetSpec::Compiler
include Matchers::Resource
context 'returns undef value' do
it 'when result is undef due to missing variable' do
expect( evaluate(source: "getvar('x')")).to ... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/any_spec.rb | spec/unit/functions/any_spec.rb | require 'puppet'
require 'spec_helper'
require 'puppet_spec/compiler'
require 'shared_behaviours/iterative_functions'
describe 'the any method' do
include PuppetSpec::Compiler
context "should be callable as" do
it 'any on an array' do
catalog = compile_to_catalog(<<-MANIFEST)
$a = [1,2,3]
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/require_spec.rb | spec/unit/functions/require_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'puppet/parser/functions'
require 'matchers/containment_matchers'
require 'matchers/resource'
require 'matchers/include_in_order'
require 'unit/functions/shared'
describe 'The "require" function' do
include PuppetSpec::Compiler
include ContainmentMatcher... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/match_spec.rb | spec/unit/functions/match_spec.rb | require 'spec_helper'
require 'puppet/pops'
require 'puppet/loaders'
describe 'the match function' do
before(:each) do
loaders = Puppet::Pops::Loaders.new(Puppet::Node::Environment.create(:testing, []))
Puppet.push_context({:loaders => loaders}, "test-examples")
end
after(:each) do
Puppet.pop_conte... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/return_spec.rb | spec/unit/functions/return_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the return function' do
include PuppetSpec::Compiler
include Matchers::Resource
context 'returns from outer function when called from nested block' do
it 'with a given value as function result' do
expect(compil... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/downcase_spec.rb | spec/unit/functions/downcase_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the downcase function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'returns lower case version of a string' do
expect(compile_to_catalog("notify { 'ABC'.downcase: }")).to have_resource('Notify[abc]'... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/new_spec.rb | spec/unit/functions/new_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the new function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'yields converted value if given a block' do
expect(compile_to_catalog(<<-MANIFEST
$x = Integer.new('42') |$x| { $x+2 }
noti... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/dig_spec.rb | spec/unit/functions/dig_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the dig function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'returns a value from an array index via integer index' do
expect(compile_to_catalog("notify { [testing].dig(0): }")).to have_resource('... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/size_spec.rb | spec/unit/functions/size_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the size function' do
include PuppetSpec::Compiler
include Matchers::Resource
context 'for an array it' do
it 'returns 0 when empty' do
expect(compile_to_catalog("notify { String(size([])): }")).to have_resourc... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/inline_epp_spec.rb | spec/unit/functions/inline_epp_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
describe "the inline_epp function" do
include PuppetSpec::Files
include PuppetSpec::Compiler
let :node do Puppet::Node.new('localhost') end
let :compiler do Puppet::Parser::Compiler.new(node) end
let :scope do Puppet::Parser::Scope.new(compiler) e... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/then_spec.rb | spec/unit/functions/then_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the then function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'calls a lambda passing one argument' do
expect(compile_to_catalog("then(testing) |$x| { notify { $x: } }")).to have_resource('Notify[t... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/camelcase_spec.rb | spec/unit/functions/camelcase_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the camelcase function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'replaces initial <char> and each _<char> with upper case version of the char' do
expect(compile_to_catalog("notify { 'abc_def'.ca... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/all_spec.rb | spec/unit/functions/all_spec.rb | require 'puppet'
require 'spec_helper'
require 'puppet_spec/compiler'
require 'shared_behaviours/iterative_functions'
describe 'the all method' do
include PuppetSpec::Compiler
context "should be callable as" do
it 'all on an array' do
catalog = compile_to_catalog(<<-MANIFEST)
$a = [1,2,3]
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/include_spec.rb | spec/unit/functions/include_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'puppet/parser/functions'
require 'matchers/containment_matchers'
require 'matchers/resource'
require 'matchers/include_in_order'
require 'unit/functions/shared'
describe 'The "include" function' do
include PuppetSpec::Compiler
include ContainmentMatcher... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/annotate_spec.rb | spec/unit/functions/annotate_spec.rb | require 'spec_helper'
require 'puppet/pops'
require 'puppet_spec/compiler'
describe 'the annotate function' do
include PuppetSpec::Compiler
let(:annotation) { <<-PUPPET }
type MyAdapter = Object[{
parent => Annotation,
attributes => {
id => Integer,
value => String[1]
}
}... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/binary_file_spec.rb | spec/unit/functions/binary_file_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
require 'puppet_spec/files'
describe 'the binary_file function' do
include PuppetSpec::Compiler
include Matchers::Resource
include PuppetSpec::Files
def with_file_content(content)
path = tmpfile('find-file-function')
file... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/type_spec.rb | spec/unit/functions/type_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the type function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'produces the type of a given value with default detailed quality' do
expect(compile_to_catalog('notify { "${ type([2, 3.14]) }": }')).to... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/with_spec.rb | spec/unit/functions/with_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the with function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'calls a lambda passing no arguments' do
expect(compile_to_catalog("with() || { notify { testing: } }")).to have_resource('Notify[testi... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/length_spec.rb | spec/unit/functions/length_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the length function' do
include PuppetSpec::Compiler
include Matchers::Resource
context 'for an array it' do
it 'returns 0 when empty' do
expect(compile_to_catalog("notify { String(length([])): }")).to have_res... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/hiera_spec.rb | spec/unit/functions/hiera_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'puppet/pops'
describe 'when calling' do
include PuppetSpec::Compiler
include PuppetSpec::Files
let(:global_dir) { tmpdir('global') }
let(:env_config) { {} }
let(:hiera_yaml) { <<-YAML.unindent }
---
:backends:
- yaml
- hierasp... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/unique_spec.rb | spec/unit/functions/unique_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the unique function' do
include PuppetSpec::Compiler
include Matchers::Resource
context 'produces the unique set of chars from a String such that' do
it 'same case is considered unique' do
expect(compile_to_cat... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/capitalize_spec.rb | spec/unit/functions/capitalize_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the capitalize function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'returns initial char upper case version of a string' do
expect(compile_to_catalog("notify { 'abc'.capitalize: }")).to have_resou... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/chomp_spec.rb | spec/unit/functions/chomp_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the chomp function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'removes line endings CR LF from a string' do
expect(compile_to_catalog("notify { String(\"abc\r\n\".chomp == 'abc'): }")).to have_res... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/flatten_spec.rb | spec/unit/functions/flatten_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the flatten function' do
include PuppetSpec::Compiler
include Matchers::Resource
let(:array_fmt) { { 'format' => "%(a", 'separator'=>""} }
it 'returns flattened array of all its given arguments' do
expect(compile_... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/compare_spec.rb | spec/unit/functions/compare_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the compare function' do
include PuppetSpec::Compiler
include Matchers::Resource
{
[0, 1] => -1,
[1, 0] => 1,
[1, 1] => 0,
[0.0, 1.0] => -1,
[1.0, 0.0] => 1,
[1.0, 1.0] => 0,
[0.0,... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/contain_spec.rb | spec/unit/functions/contain_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'puppet/parser/functions'
require 'matchers/containment_matchers'
require 'matchers/resource'
require 'matchers/include_in_order'
require 'unit/functions/shared'
describe 'The "contain" function' do
include PuppetSpec::Compiler
include ContainmentMatcher... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/versioncmp_spec.rb | spec/unit/functions/versioncmp_spec.rb | require 'spec_helper'
require 'puppet/pops'
require 'puppet/loaders'
describe "the versioncmp function" do
before(:each) do
loaders = Puppet::Pops::Loaders.new(Puppet::Node::Environment.create(:testing, []))
Puppet.push_context({:loaders => loaders}, "test-examples")
end
after(:each) do
Puppet::pop_... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/abs_spec.rb | spec/unit/functions/abs_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the abs function' do
include PuppetSpec::Compiler
include Matchers::Resource
context 'for an integer' do
{ 0 => 0,
1 => 1,
-1 => 1 }.each_pair do |x, expected|
it "called as abs(#{x}) results in #{e... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/logging_spec.rb | spec/unit/functions/logging_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
describe 'the log function' do
include PuppetSpec::Compiler
def collect_logs(code)
Puppet[:code] = code
Puppet[:environment_timeout] = 10
node = Puppet::Node.new('logtest')
compiler = Puppet::Parser::Compiler.new(node)
node.environment.check... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/ceiling_spec.rb | spec/unit/functions/ceiling_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the ceiling function' do
include PuppetSpec::Compiler
include Matchers::Resource
context 'for an integer' do
[ 0, 1, -1].each do |x|
it "called as ceiling(#{x}) results in the same value" do
expect(comp... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/map_spec.rb | spec/unit/functions/map_spec.rb | require 'puppet'
require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
require 'shared_behaviours/iterative_functions'
describe 'the map method can' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'map on an array (multiplying each value by 2)' do
catalog = comp... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/find_file_spec.rb | spec/unit/functions/find_file_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
require 'puppet_spec/files'
describe 'the find_file function' do
include PuppetSpec::Compiler
include Matchers::Resource
include PuppetSpec::Files
def with_file_content(content)
path = tmpfile('find-file-function')
file =... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/sort_spec.rb | spec/unit/functions/sort_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the sort function' do
include PuppetSpec::Compiler
include Matchers::Resource
{
"'bac'" => "'abc'",
"'BaC'" => "'BCa'",
}.each_pair do |value, expected|
it "sorts characters in a string su... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/reverse_each_spec.rb | spec/unit/functions/reverse_each_spec.rb | require 'puppet'
require 'spec_helper'
require 'puppet_spec/compiler'
require 'shared_behaviours/iterative_functions'
describe 'the reverse_each function' do
include PuppetSpec::Compiler
it 'raises an error when given a type that cannot be iterated' do
expect do
compile_to_catalog(<<-MANIFEST)
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/scanf_spec.rb | spec/unit/functions/scanf_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the scanf function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'scans a value and returns an array' do
expect(compile_to_catalog("$x = '42'.scanf('%i')[0] + 1; notify { \"test$x\": }")).to have_res... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/rstrip_spec.rb | spec/unit/functions/rstrip_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the rstrip function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'removes trailing whitepsace' do
expect(compile_to_catalog("notify { String(\" abc\t\n \".rstrip == ' abc'): }")).to have_resource('N... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/group_by_spec.rb | spec/unit/functions/group_by_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the group_by function' do
include PuppetSpec::Compiler
include Matchers::Resource
context 'for an array' do
it 'groups by item' do
manifest = "notify { String(group_by([a, b, ab]) |$s| { $s.length }): }"
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/chop_spec.rb | spec/unit/functions/chop_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the chop function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'removes last character in a string' do
expect(compile_to_catalog("notify { String('abc'.chop == 'ab'): }")).to have_resource('Notify[t... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/assert_type_spec.rb | spec/unit/functions/assert_type_spec.rb | require 'spec_helper'
require 'puppet/pops'
require 'puppet/loaders'
require 'puppet_spec/compiler'
describe 'the assert_type function' do
include PuppetSpec::Compiler
after(:all) { Puppet::Pops::Loaders.clear }
let(:loaders) { Puppet::Pops::Loaders.new(Puppet::Node::Environment.create(:testing, [])) }
let(:... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/defined_spec.rb | spec/unit/functions/defined_spec.rb | require 'spec_helper'
require 'puppet/pops'
require 'puppet/loaders'
describe "the 'defined' function" do
after(:all) { Puppet::Pops::Loaders.clear }
# This loads the function once and makes it easy to call it
# It does not matter that it is not bound to the env used later since the function
# looks up everyt... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/filter_spec.rb | spec/unit/functions/filter_spec.rb | require 'puppet'
require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
require 'shared_behaviours/iterative_functions'
describe 'the filter method' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'should filter on an array (all berries)' do
catalog = compile_to_cata... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/reduce_spec.rb | spec/unit/functions/reduce_spec.rb | require 'puppet'
require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
require 'shared_behaviours/iterative_functions'
describe 'the reduce method' do
include PuppetSpec::Compiler
include Matchers::Resource
before :each do
node = Puppet::Node.new("floppy", :environment => 'pr... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/empty_spec.rb | spec/unit/functions/empty_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the empty function' do
include PuppetSpec::Compiler
include Matchers::Resource
let(:logs) { [] }
let(:warnings) { logs.select { |log| log.level == :warning }.map { |log| log.message } }
context 'for an array it' do
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/split_spec.rb | spec/unit/functions/split_spec.rb | require 'spec_helper'
require 'puppet/pops'
require 'puppet/loaders'
describe 'the split function' do
before(:each) do
loaders = Puppet::Pops::Loaders.new(Puppet::Node::Environment.create(:testing, []))
Puppet.push_context({:loaders => loaders}, "test-examples")
end
after(:each) do
Puppet.pop_conte... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/values_spec.rb | spec/unit/functions/values_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the values function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'returns the values in the hash in the order they appear in a hash iteration' do
expect(compile_to_catalog(<<-'SRC'.unindent)).to hav... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/upcase_spec.rb | spec/unit/functions/upcase_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the upcase function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'returns upper case version of a string' do
expect(compile_to_catalog("notify { 'abc'.upcase: }")).to have_resource('Notify[ABC]')
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/get_spec.rb | spec/unit/functions/get_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the get function' do
include PuppetSpec::Compiler
include Matchers::Resource
context 'returns undef value' do
it 'when result is undef due to given undef' do
expect( evaluate(source: "get(undef, '')")).to be_ni... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/call_spec.rb | spec/unit/functions/call_spec.rb | require 'puppet'
require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the call method' do
include PuppetSpec::Compiler
include PuppetSpec::Files
include Matchers::Resource
context "should be callable as" do
let(:env_name) { 'testenv' }
let(:environments_dir) { Pu... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/keys_spec.rb | spec/unit/functions/keys_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the keys function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'returns the keys in the hash in the order they appear in a hash iteration' do
expect(compile_to_catalog(<<-'SRC'.unindent)).to have_re... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/lookup_fixture_spec.rb | spec/unit/functions/lookup_fixture_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'puppet_spec/files'
require 'puppet/pops'
require 'deep_merge/core'
# Tests the lookup function using fixtures
describe 'The lookup function' do
include PuppetSpec::Compiler
# Assembles code that includes the *abc* class and compiles it into a catalog. ... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/each_spec.rb | spec/unit/functions/each_spec.rb | require 'puppet'
require 'spec_helper'
require 'puppet_spec/compiler'
require 'shared_behaviours/iterative_functions'
describe 'the each method' do
include PuppetSpec::Compiler
context "should be callable as" do
it 'each on an array selecting each value' do
catalog = compile_to_catalog(<<-MANIFEST)
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/strip_spec.rb | spec/unit/functions/strip_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the strip function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'removes leading and trailing whitepsace' do
expect(compile_to_catalog("notify { String(\" abc\t\n \".strip == 'abc'): }")).to have_re... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/join_spec.rb | spec/unit/functions/join_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the join function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'joins an array with empty string delimiter if delimiter is not given' do
expect(compile_to_catalog("notify { join([1,2,3]): }")).to ha... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/round_spec.rb | spec/unit/functions/round_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the round function' do
include PuppetSpec::Compiler
include Matchers::Resource
context 'for an integer' do
[ 0, 1, -1].each do |x|
it "called as round(#{x}) results in the same value" do
expect(compile_... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/lookup_spec.rb | spec/unit/functions/lookup_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'puppet_spec/files'
require 'puppet/pops'
require 'deep_merge/core'
describe "The lookup function" do
include PuppetSpec::Compiler
include PuppetSpec::Files
let(:env_name) { 'spec' }
let(:code_dir_files) { {} }
let(:code_dir) { tmpdir('code') }
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | true |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/unwrap_spec.rb | spec/unit/functions/unwrap_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the unwrap function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'unwraps a sensitive value' do
code = <<-CODE
$sensitive = Sensitive.new("12345")
notice("unwrapped value is ${sensitive.... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/tree_each_spec.rb | spec/unit/functions/tree_each_spec.rb | require 'puppet'
require 'spec_helper'
require 'puppet_spec/compiler'
require 'shared_behaviours/iterative_functions'
describe 'the tree_each function' do
include PuppetSpec::Compiler
context "can be called on" do
it 'an Array, yielding path and value when lambda has arity 2' do
catalog = compile_to_ca... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/slice_spec.rb | spec/unit/functions/slice_spec.rb | require 'puppet'
require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'methods' do
include PuppetSpec::Compiler
include Matchers::Resource
before :each do
node = Puppet::Node.new("floppy", :environment => 'production')
@compiler = Puppet::Parser::Compiler.new(no... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/lstrip_spec.rb | spec/unit/functions/lstrip_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the lstrip function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'removes leading whitepsace' do
expect(compile_to_catalog("notify { String(\"\t\n abc \".lstrip == 'abc '): }")).to have_resource('No... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/max_spec.rb | spec/unit/functions/max_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the max function' do
include PuppetSpec::Compiler
include Matchers::Resource
let(:logs) { [] }
let(:warnings) { logs.select { |log| log.level == :warning }.map { |log| log.message } }
it 'errors if not give at least... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/find_template_spec.rb | spec/unit/functions/find_template_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
require 'puppet_spec/files'
describe 'the find_template function' do
include PuppetSpec::Compiler
include Matchers::Resource
include PuppetSpec::Files
def with_file_content(content)
path = tmpfile('find-file-function')
fi... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/epp_spec.rb | spec/unit/functions/epp_spec.rb | require 'spec_helper'
describe "the epp function" do
include PuppetSpec::Files
let :node do Puppet::Node.new('localhost') end
let :compiler do Puppet::Parser::Compiler.new(node) end
let :scope do compiler.topscope end
context "when accessing scope variables as $ variables" do
it "looks up the va... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/strftime_spec.rb | spec/unit/functions/strftime_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
describe 'the strftime function' do
include PuppetSpec::Compiler
def test_format(ctor_arg, format, expected)
expect(eval_and_collect_notices("notice(strftime(Timespan(#{ctor_arg}), '#{format}'))")).to eql(["#{expected}"])
end
context 'when applied to a... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/index_spec.rb | spec/unit/functions/index_spec.rb | require 'puppet'
require 'spec_helper'
require 'puppet_spec/compiler'
require 'shared_behaviours/iterative_functions'
describe 'the index function' do
include PuppetSpec::Compiler
context "should be callable on Array with" do
it 'a lambda to compute match' do
catalog = compile_to_catalog(<<-MANIFEST)
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/regsubst_spec.rb | spec/unit/functions/regsubst_spec.rb | require 'spec_helper'
require 'puppet/pops'
require 'puppet/loaders'
describe 'the regsubst function' do
before(:each) do
loaders = Puppet::Pops::Loaders.new(Puppet::Node::Environment.create(:testing, []))
Puppet.push_context({:loaders => loaders}, "test-examples")
end
after(:each) do
Puppet.pop_co... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/module_directory_spec.rb | spec/unit/functions/module_directory_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
require 'puppet_spec/files'
describe 'the module_directory function' do
include PuppetSpec::Compiler
include Matchers::Resource
include PuppetSpec::Files
it 'returns first found module from one or more given names' do
mod = d... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/convert_to_spec.rb | spec/unit/functions/convert_to_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the convert_to function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'converts and returns the converted when no lambda is given' do
expect(compile_to_catalog('notify{ "testing-${[a,1].convert_to(Ha... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/next_spec.rb | spec/unit/functions/next_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the next function' do
include PuppetSpec::Compiler
include Matchers::Resource
context 'exits a block yielded to iteratively' do
it 'with a given value as result for this iteration' do
expect(compile_to_catalog(... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/shared.rb | spec/unit/functions/shared.rb | shared_examples_for 'all functions transforming relative to absolute names' do |func_name|
before(:each) do
# mock that the class 'myclass' exists which are needed for the 'require' functions
# as it checks the existence of the required class
@klass = double('class', :name => "myclass")
allow(@scope.e... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions/lest_spec.rb | spec/unit/functions/lest_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
describe 'the lest function' do
include PuppetSpec::Compiler
include Matchers::Resource
it 'calls a lambda passing no argument' do
expect(compile_to_catalog("lest(undef) || { notify { testing: } }")).to have_resource('Notify[t... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/format_handler_spec.rb | spec/unit/network/format_handler_spec.rb | require 'spec_helper'
require 'puppet/network/format_handler'
describe Puppet::Network::FormatHandler do
before(:each) do
@saved_formats = Puppet::Network::FormatHandler.instance_variable_get(:@formats).dup
Puppet::Network::FormatHandler.instance_variable_set(:@formats, {})
end
after(:each) do
Pupp... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/authorization_spec.rb | spec/unit/network/authorization_spec.rb | require 'spec_helper'
require 'puppet/network/authorization'
describe Puppet::Network::Authorization do
it "accepts an auth config loader class" do
Puppet::Network::Authorization.authconfigloader_class = Object
end
end
| ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/format_support_spec.rb | spec/unit/network/format_support_spec.rb | require 'spec_helper'
require 'puppet/network/format_handler'
require 'puppet/network/format_support'
class FormatTester
include Puppet::Network::FormatSupport
end
describe Puppet::Network::FormatHandler do
before(:each) do
@saved_formats = Puppet::Network::FormatHandler.instance_variable_get(:@formats).dup
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/format_spec.rb | spec/unit/network/format_spec.rb | require 'spec_helper'
require 'puppet/network/format'
# A class with all of the necessary
# hooks.
class FormatRenderer
def self.to_multiple_my_format(list)
end
def self.from_multiple_my_format(text)
end
def self.from_my_format(text)
end
def to_my_format
end
end
describe Puppet::Network::Format do... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/formats_spec.rb | spec/unit/network/formats_spec.rb | require 'spec_helper'
require 'puppet/network/formats'
require 'puppet/network/format_support'
class FormatsTest
include Puppet::Network::FormatSupport
attr_accessor :string
def ==(other)
string == other.string
end
def self.from_data_hash(data)
new(data['string'])
end
def initialize(string)
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/authconfig_spec.rb | spec/unit/network/authconfig_spec.rb | require 'spec_helper'
require 'puppet/network/authconfig'
describe Puppet::Network::AuthConfig do
it "accepts an auth provider class" do
Puppet::Network::AuthConfig.authprovider_class = Object
end
end
| ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/uri_spec.rb | spec/unit/network/uri_spec.rb | require 'spec_helper'
require 'puppet/network/uri'
describe Puppet::Network::Uri do
include Puppet::Network::Uri
describe '.mask_credentials' do
let(:address_with_passwd) { 'https://admin:S3cr3T@puppetforge.acmecorp.com/' }
let(:masked) { 'https://admin:***@puppetforge.acmecorp.com/' }
let(:address) { ... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/http_pool_spec.rb | spec/unit/network/http_pool_spec.rb | require 'spec_helper'
require 'puppet/network/http_pool'
class Puppet::Network::HttpPool::FooClient
def initialize(host, port, options = {})
@host = host
@port = port
end
attr_reader :host, :port
end
describe Puppet::Network::HttpPool do
include PuppetSpec::Files
describe "when registering an http ... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/http/response_spec.rb | spec/unit/network/http/response_spec.rb | require 'spec_helper'
require 'puppet_spec/files'
require 'puppet_spec/handler'
require 'puppet/network/http'
describe Puppet::Network::HTTP::Response do
include PuppetSpec::Files
let(:handler) { PuppetSpec::Handler.new }
let(:response) { {} }
let(:subject) { described_class.new(handler, response) }
let(:bo... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/http/request_spec.rb | spec/unit/network/http/request_spec.rb | require 'spec_helper'
require 'puppet_spec/network'
require 'puppet/network/http'
describe Puppet::Network::HTTP::Request do
include PuppetSpec::Network
let(:json_formatter) { Puppet::Network::FormatHandler.format(:json) }
let(:pson_formatter) { Puppet::Network::FormatHandler.format(:pson) }
def headers
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/http/api_spec.rb | spec/unit/network/http/api_spec.rb | require 'spec_helper'
require 'puppet_spec/handler'
require 'puppet/network/http'
require 'puppet/version'
describe Puppet::Network::HTTP::API do
def respond(text)
lambda { |req, res| res.respond_with(200, "text/plain", text) }
end
describe "#not_found" do
let(:response) { Puppet::Network::HTTP::MemoryR... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/http/connection_spec.rb | spec/unit/network/http/connection_spec.rb | require 'spec_helper'
require 'puppet/network/http/connection'
require 'puppet/test_ca'
describe Puppet::Network::HTTP::Connection do
let(:host) { "me.example.com" }
let(:port) { 8140 }
let(:path) { '/foo' }
let(:url) { "https://#{host}:#{port}#{path}" }
let(:params) { { 'key' => 'a value' } }
let(:encoded... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/http/route_spec.rb | spec/unit/network/http/route_spec.rb | require 'spec_helper'
require 'puppet/indirector_testing'
require 'puppet/network/http'
describe Puppet::Network::HTTP::Route do
def request(method, path)
Puppet::Network::HTTP::Request.from_hash({
:method => method,
:path => path,
:routing_path => path })
end
def respond(text)
lambda... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/http/error_spec.rb | spec/unit/network/http/error_spec.rb | require 'spec_helper'
require 'matchers/json'
require 'puppet/network/http'
describe Puppet::Network::HTTP::Error do
include JSONMatchers
describe Puppet::Network::HTTP::Error::HTTPError do
it "should serialize to JSON that matches the error schema" do
error = Puppet::Network::HTTP::Error::HTTPError.ne... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/http/handler_spec.rb | spec/unit/network/http/handler_spec.rb | require 'spec_helper'
require 'puppet_spec/handler'
require 'puppet/indirector_testing'
require 'puppet/network/http'
describe Puppet::Network::HTTP::Handler do
before :each do
Puppet::IndirectorTesting.indirection.terminus_class = :memory
end
let(:indirection) { Puppet::IndirectorTesting.indirection }
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/http/api/indirected_routes_spec.rb | spec/unit/network/http/api/indirected_routes_spec.rb | require 'spec_helper'
require 'puppet/network/http'
require 'puppet/network/http/api/indirected_routes'
require 'puppet/indirector_testing'
require 'puppet_spec/network'
RSpec::Matchers.define_negated_matcher :excluding, :include
describe Puppet::Network::HTTP::API::IndirectedRoutes do
include PuppetSpec::Network
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/http/api/master_spec.rb | spec/unit/network/http/api/master_spec.rb | # Tests the backwards compatibility of our master -> server changes
# in the HTTP API
# This may be removed in Puppet 8
require 'spec_helper'
require 'puppet/network/http'
require 'puppet_spec/network'
describe Puppet::Network::HTTP::API::Master::V3 do
include PuppetSpec::Network
let(:response) { Puppet::Network... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/http/api/server/v3_spec.rb | spec/unit/network/http/api/server/v3_spec.rb | require 'spec_helper'
require 'puppet/network/http'
require 'puppet_spec/network'
describe Puppet::Network::HTTP::API::Server::V3 do
include PuppetSpec::Network
let(:response) { Puppet::Network::HTTP::MemoryResponse.new }
let(:server_url_prefix) { "#{Puppet::Network::HTTP::SERVER_URL_PREFIX}/v3" }
let(:serve... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/network/http/api/server/v3/environments_spec.rb | spec/unit/network/http/api/server/v3/environments_spec.rb | require 'spec_helper'
require 'puppet/node/environment'
require 'puppet/network/http'
require 'matchers/json'
describe Puppet::Network::HTTP::API::Server::V3::Environments do
include JSONMatchers
let(:environment) { Puppet::Node::Environment.create(:production, ["/first", "/second"], '/manifests') }
let(:loade... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/file_serving/fileset_spec.rb | spec/unit/file_serving/fileset_spec.rb | require 'spec_helper'
require 'puppet/file_serving/fileset'
describe Puppet::FileServing::Fileset do
include PuppetSpec::Files
let(:somefile) { make_absolute("/some/file") }
context "when initializing" do
it "requires a path" do
expect { Puppet::FileServing::Fileset.new }.to raise_error(ArgumentError... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/file_serving/metadata_spec.rb | spec/unit/file_serving/metadata_spec.rb | require 'spec_helper'
require 'puppet/file_serving/metadata'
require 'matchers/json'
describe Puppet::FileServing::Metadata do
let(:foobar) { File.expand_path('/foo/bar') }
it "should be a subclass of Base" do
expect(Puppet::FileServing::Metadata.superclass).to equal(Puppet::FileServing::Base)
end
it "sh... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.