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/lib/puppet_spec/character_encoding.rb | spec/lib/puppet_spec/character_encoding.rb | # A support module for testing character encoding
module PuppetSpec::CharacterEncoding
def self.with_external_encoding(encoding, &blk)
original_encoding = Encoding.default_external
begin
Encoding.default_external = encoding
yield
ensure
Encoding.default_external = original_encoding
e... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet_spec/modules.rb | spec/lib/puppet_spec/modules.rb | module PuppetSpec::Modules
class << self
def create(name, dir, options = {})
module_dir = File.join(dir, name)
FileUtils.mkdir_p(module_dir)
environment = options[:environment]
metadata = options[:metadata]
if metadata
metadata[:source] ||= 'github'
metadata[:autho... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet_spec/pops.rb | spec/lib/puppet_spec/pops.rb | module PuppetSpec::Pops
extend RSpec::Matchers::DSL
# Checks if an Acceptor has a specific issue in its list of diagnostics
matcher :have_issue do |expected|
match do |actual|
actual.diagnostics.index { |i| i.issue == expected } != nil
end
failure_message do |actual|
"expected Acceptor[#{... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet_spec/module_tool/stub_source.rb | spec/lib/puppet_spec/module_tool/stub_source.rb | module PuppetSpec
module ModuleTool
class StubSource < SemanticPuppet::Dependency::Source
def inspect; "Stub Source"; end
def host
"http://nowhe.re"
end
def fetch(name)
available_releases[name.tr('/', '-')].values
end
def available_releases
return @ava... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet_spec/module_tool/shared_functions.rb | spec/lib/puppet_spec/module_tool/shared_functions.rb | require 'puppet/util/json'
module PuppetSpec
module ModuleTool
module SharedFunctions
def remote_release(name, version)
remote_source.available_releases[name][version]
end
def preinstall(name, version, options = { :into => primary_dir })
release = remote_release(name, version)
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet/certificate_factory.rb | spec/lib/puppet/certificate_factory.rb | require 'puppet/ssl'
# This class encapsulates the logic of creating and adding extensions to X509
# certificates.
#
# @api private
module Puppet::CertificateFactory
# Create a new X509 certificate and add any needed extensions to the cert.
#
# @param cert_type [Symbol] The certificate type to create, which spe... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet/indirector_proxy.rb | spec/lib/puppet/indirector_proxy.rb | class Puppet::IndirectorProxy
class ProxyId
attr_accessor :name
def initialize(name)
self.name = name
end
end
# We should have some way to identify if we got a valid object back with the
# current values, no?
attr_accessor :value, :proxyname
alias_method :name, :value
alias_method :name... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet/test_ca.rb | spec/lib/puppet/test_ca.rb | module Puppet
class TestCa
CERT_VALID_FROM = Time.at(0).freeze # 1969-12-31 16:00:00 -0800
CERT_VALID_UNTIL = (Time.now + (10 * 365 * 24 * 60 * 60)).freeze # 10 years from now
CA_EXTENSIONS = [
["basicConstraints", "CA:TRUE", true],
["keyUsage", "keyCertSign, cRLSign", true],
["subject... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet/indirector_testing.rb | spec/lib/puppet/indirector_testing.rb | require 'puppet/indirector'
class Puppet::IndirectorTesting
extend Puppet::Indirector
indirects :indirector_testing
# We should have some way to identify if we got a valid object back with the
# current values, no?
attr_accessor :value
alias_method :name, :value
alias_method :name=, :value=
def initia... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet/indirector/indirector_testing/memory.rb | spec/lib/puppet/indirector/indirector_testing/memory.rb | require 'puppet/indirector/memory'
class Puppet::IndirectorTesting::Memory < Puppet::Indirector::Memory
def supports_remote_requests?
true
end
end
| ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet/indirector/indirector_testing/msgpack.rb | spec/lib/puppet/indirector/indirector_testing/msgpack.rb | require 'puppet/indirector_testing'
require 'puppet/indirector/msgpack'
class Puppet::IndirectorTesting::Msgpack < Puppet::Indirector::Msgpack
desc "Testing the MessagePack indirector"
end
| ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet/indirector/indirector_testing/json.rb | spec/lib/puppet/indirector/indirector_testing/json.rb | require 'puppet/indirector_testing'
require 'puppet/indirector/json'
class Puppet::IndirectorTesting::JSON < Puppet::Indirector::JSON
desc "Testing the JSON indirector"
end
| ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet/face/basetest.rb | spec/lib/puppet/face/basetest.rb | require 'puppet/face'
Puppet::Face.define(:basetest, '0.0.1') do
copyright "Puppet Inc.", 2011
license "Apache 2 license; see COPYING"
summary "This is just so tests don't fail"
option "--[no-]boolean"
option "--mandatory ARGUMENT"
action :foo do
option("--action")
when_invoked do |*args| args.... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet/face/huzzah.rb | spec/lib/puppet/face/huzzah.rb | require 'puppet/face'
Puppet::Face.define(:huzzah, '2.0.1') do
copyright "Puppet Inc.", 2011
license "Apache 2 license; see COPYING"
summary "life is a thing for celebration"
action(:bar) { when_invoked { |options| "is where beer comes from" } }
action(:call_older) { when_invoked { |_| method_on_older } }
e... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet/face/version_matching.rb | spec/lib/puppet/face/version_matching.rb | require 'puppet/face'
# The set of versions here are used explicitly in the interface_spec; if you
# change this you need to ensure that is still correct. --daniel 2011-04-21
['1.0.0', '1.0.1', '1.1.0', '1.1.1', '2.0.0'].each do |version|
Puppet::Face.define(:version_matching, version) do
copyright "Puppet Inc."... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet/face/1.0.0/huzzah.rb | spec/lib/puppet/face/1.0.0/huzzah.rb | require 'puppet/face'
Puppet::Face.define(:huzzah, '1.0.0') do
copyright "Puppet Inc.", 2011
license "Apache 2 license; see COPYING"
summary "life is a thing for celebration"
action(:obsolete_in_core) { when_invoked { |_| "you are in obsolete core now!" } }
action(:call_newer) { when_invoked { |_| method_on... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/lib/puppet/face/huzzah/obsolete.rb | spec/lib/puppet/face/huzzah/obsolete.rb | Puppet::Face.define(:huzzah, '1.0.0') do
action :obsolete do
summary "This is an action on version 1.0.0 of the face"
when_invoked do |options| options end
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/environments_spec.rb | spec/unit/environments_spec.rb | require 'spec_helper'
require 'puppet/environments'
require 'puppet/file_system'
describe Puppet::Environments do
FS = Puppet::FileSystem
module FsRemove
def remove
@properties[:directory?] = false
@properties[:exist?] = false
@properties[:executable?] = false
end
end
before(:each) ... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | true |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/hiera_puppet_spec.rb | spec/unit/hiera_puppet_spec.rb | require 'spec_helper'
require 'hiera_puppet'
require 'puppet_spec/scope'
describe 'HieraPuppet', :if => Puppet.features.hiera? do
include PuppetSpec::Scope
after(:all) do
HieraPuppet.instance_variable_set(:@hiera, nil)
end
describe 'HieraPuppet#hiera_config' do
let(:hiera_config_data) do
{ :bac... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/agent_spec.rb | spec/unit/agent_spec.rb | require 'spec_helper'
require 'puppet/agent'
require 'puppet/configurer'
class AgentTestClient
def initialize(transaction_uuid = nil, job_id = nil)
end
def run(client_args)
# no-op
end
def stop
# no-op
end
end
describe Puppet::Agent do
before do
@agent = Puppet::Agent.new(AgentTestClient, ... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/confine_collection_spec.rb | spec/unit/confine_collection_spec.rb | require 'spec_helper'
require 'puppet/confine_collection'
describe Puppet::ConfineCollection do
it "should be able to add confines" do
expect(Puppet::ConfineCollection.new("label")).to respond_to(:confine)
end
it "should require a label at initialization" do
expect { Puppet::ConfineCollection.new }.to ... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/info_service_spec.rb | spec/unit/info_service_spec.rb | require 'spec_helper'
require 'puppet_spec/files'
require 'puppet_spec/modules'
require 'puppet/pops'
require 'puppet/info_service'
require 'puppet/pops/evaluator/literal_evaluator'
describe "Puppet::InfoService" do
include PuppetSpec::Files
context 'task information service' do
let(:mod_name) { 'test1' }
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/version_spec.rb | spec/unit/version_spec.rb | require "spec_helper"
require "puppet/version"
require 'pathname'
describe "Puppet.version Public API" do
before :each do
@current_ver = Puppet.version
Puppet.instance_eval do
if @puppet_version
@puppet_version = nil
end
end
end
after :each do
Puppet.version = @current_ver
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/certificate_factory_spec.rb | spec/unit/certificate_factory_spec.rb | require 'spec_helper'
require 'puppet/test_ca'
require 'puppet/certificate_factory'
describe Puppet::CertificateFactory, :unless => RUBY_PLATFORM == 'java' do
let :serial do OpenSSL::BN.new('12') end
let :name do "example.local" end
let :x509_name do OpenSSL::X509::Name.new([['CN', name]]) end
let :ke... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/relationship_spec.rb | spec/unit/relationship_spec.rb | require 'spec_helper'
require 'puppet/relationship'
describe Puppet::Relationship do
before do
@edge = Puppet::Relationship.new(:a, :b)
end
it "should have a :source attribute" do
expect(@edge).to respond_to(:source)
end
it "should have a :target attribute" do
expect(@edge).to respond_to(:targe... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/confiner_spec.rb | spec/unit/confiner_spec.rb | require 'spec_helper'
require 'puppet/confiner'
describe Puppet::Confiner do
let(:coll) { Puppet::ConfineCollection.new('') }
before do
@object = Object.new
@object.extend(Puppet::Confiner)
end
it "should have a method for defining confines" do
expect(@object).to respond_to(:confine)
end
it... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/interface_spec.rb | spec/unit/interface_spec.rb | require 'spec_helper'
require 'puppet/face'
require 'puppet/interface'
describe Puppet::Interface do
subject { Puppet::Interface }
before :each do
@faces = Puppet::Interface::FaceCollection.
instance_variable_get("@faces").dup
@dq = $".dup
$".delete_if do |path| path =~ %r{/face/.*\.rb$} end
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/provider_spec.rb | spec/unit/provider_spec.rb | require 'spec_helper'
def existing_command
Puppet::Util::Platform.windows? ? "cmd" : "echo"
end
describe Puppet::Provider do
before :each do
Puppet::Type.newtype(:test) do
newparam(:name) { isnamevar }
end
end
after :each do
Puppet::Type.type(:test).provider_hash.clear
Puppet::Type.rmty... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/face_spec.rb | spec/unit/face_spec.rb | # You should look at interface_spec.rb
| ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/confine_spec.rb | spec/unit/confine_spec.rb | require 'spec_helper'
require 'puppet/confine'
class Puppet::TestConfine < Puppet::Confine
def pass?(value)
false
end
end
describe Puppet::Confine do
it "should require a value" do
expect { Puppet::Confine.new }.to raise_error(ArgumentError)
end
it "should always convert values to an array" do
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/context_spec.rb | spec/unit/context_spec.rb | require 'spec_helper'
describe Puppet::Context do
let(:context) { Puppet::Context.new({ :testing => "value" }) }
describe "with additional context" do
before :each do
context.push("a" => 1)
end
it "allows rebinding values in a nested context" do
inner = nil
context.override("a" => 2... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/plan_spec.rb | spec/unit/plan_spec.rb | require 'spec_helper'
require 'puppet_spec/files'
require 'puppet_spec/modules'
require 'puppet/module/plan'
describe Puppet::Module::Plan do
include PuppetSpec::Files
let(:modpath) { tmpdir('plan_modpath') }
let(:mymodpath) { File.join(modpath, 'mymod') }
let(:othermodpath) { File.join(modpath, 'othermod') }... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/type_spec.rb | spec/unit/type_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'puppet/property/boolean'
Puppet::Type.newtype(:type_test) do
ensurable
newparam(:name, isnamevar: true)
newproperty(:device)
newproperty(:blockdevice)
newproperty(:fstype)
newproperty(:options)
newproperty(:pass)
newproperty(:atboot, parent:... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | true |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/file_system_spec.rb | spec/unit/file_system_spec.rb | require 'spec_helper'
require 'puppet/file_system'
require 'puppet/util/platform'
describe "Puppet::FileSystem" do
include PuppetSpec::Files
# different UTF-8 widths
# 1-byte A
# 2-byte ۿ - http://www.fileformat.info/info/unicode/char/06ff/index.htm - 0xDB 0xBF / 219 191
# 3-byte ᚠ - http://www.fileformat.i... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | true |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/puppet_spec.rb | spec/unit/puppet_spec.rb | require 'spec_helper'
require 'puppet'
require 'puppet_spec/files'
describe Puppet do
include PuppetSpec::Files
context "#version" do
it "should be valid semver" do
expect(SemanticPuppet::Version).to be_valid Puppet.version
end
end
Puppet::Util::Log.eachlevel do |level|
it "should have a me... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/facter_impl_spec.rb | spec/unit/facter_impl_spec.rb | require 'spec_helper'
describe 'Puppet::FacterImpl' do
subject(:facter_impl) { Puppet::FacterImpl.new }
it { is_expected.to respond_to(:value) }
it { is_expected.to respond_to(:add) }
describe '.value' do
let(:method_name) { :value }
before { allow(Facter).to receive(method_name) }
it 'delegate... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/configurer_spec.rb | spec/unit/configurer_spec.rb | require 'spec_helper'
require 'puppet/configurer'
describe Puppet::Configurer do
include PuppetSpec::Files
before do
Puppet[:server] = "puppetmaster"
Puppet[:report] = true
catalog.add_resource(resource)
Puppet[:lastrunfile] = file_containing('last_run_summary.yaml', <<~SUMMARY)
---
vers... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | true |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/module_spec.rb | spec/unit/module_spec.rb | require 'spec_helper'
require 'puppet_spec/files'
require 'puppet_spec/modules'
require 'puppet/module_tool/checksums'
describe Puppet::Module do
include PuppetSpec::Files
let(:env) { double("environment") }
let(:path) { "/path" }
let(:name) { "mymod" }
let(:mod) { Puppet::Module.new(name, path, env) }
b... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | true |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/forge_spec.rb | spec/unit/forge_spec.rb | require 'spec_helper'
require 'spec_helper'
require 'net/http'
require 'puppet/forge'
require 'puppet/module_tool'
describe Puppet::Forge do
let(:http_response) do
File.read(my_fixture('bacula.json'))
end
let(:search_results) do
JSON.parse(http_response)['results'].map do |hash|
hash.merge(
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/indirector_spec.rb | spec/unit/indirector_spec.rb | require 'spec_helper'
require 'puppet/defaults'
require 'puppet/indirector'
describe Puppet::Indirector, "when configuring routes" do
before :each do
Puppet::Node.indirection.reset_terminus_class
Puppet::Node.indirection.cache_class = nil
end
after :each do
Puppet::Node.indirection.reset_terminus_c... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/puppet_pal_catalog_spec.rb | spec/unit/puppet_pal_catalog_spec.rb | #! /usr/bin/env ruby
require 'spec_helper'
require 'puppet_spec/files'
require 'puppet_pal'
describe 'Puppet Pal' do
include PuppetSpec::Files
let(:testing_env) do
{
'pal_env' => {
'functions' => functions,
'lib' => { 'puppet' => lib_puppet },
'manifests' => manifests,
'm... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | true |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util_spec.rb | spec/unit/util_spec.rb | require 'spec_helper'
describe Puppet::Util do
include PuppetSpec::Files
if Puppet::Util::Platform.windows?
def set_mode(mode, file)
Puppet::Util::Windows::Security.set_mode(mode, file)
end
def get_mode(file)
Puppet::Util::Windows::Security.get_mode(file) & 07777
end
else
def se... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | true |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/daemon_spec.rb | spec/unit/daemon_spec.rb | require 'spec_helper'
require 'puppet/daemon'
require 'puppet/agent'
require 'puppet/configurer'
describe Puppet::Daemon, :unless => Puppet::Util::Platform.windows? do
include PuppetSpec::Files
class RecordingScheduler
attr_reader :jobs
def run_loop(jobs)
@jobs = jobs
end
end
let(:agent) {... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/property_spec.rb | spec/unit/property_spec.rb | require 'spec_helper'
require 'puppet/property'
Puppet::Type.newtype(:property_test) do
newparam(:name, isnamevar: true)
end
Puppet::Type.type(:property_test).provide(:property_test) do
attr_accessor :foo
end
describe Puppet::Property do
let :resource do
Puppet::Type.type(:property_test).new(:name => "foo")... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/settings_spec.rb | spec/unit/settings_spec.rb | require 'spec_helper'
require 'ostruct'
require 'puppet/settings/errors'
require 'puppet_spec/files'
require 'matchers/resource'
describe Puppet::Settings do
include PuppetSpec::Files
include Matchers::Resource
let(:main_config_file_default_location) do
File.join(Puppet::Util::RunMode[:server].conf_dir, "pu... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | true |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/functions4_spec.rb | spec/unit/functions4_spec.rb | require 'spec_helper'
require 'puppet/pops'
require 'puppet/loaders'
require 'puppet_spec/pops'
require 'puppet_spec/scope'
module FunctionAPISpecModule
class TestDuck
end
class TestFunctionLoader < Puppet::Pops::Loader::StaticLoader
def initialize
@constants = {}
end
def add_function(name, f... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | true |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/reports_spec.rb | spec/unit/reports_spec.rb | require 'spec_helper'
require 'puppet/reports'
describe Puppet::Reports do
it "should instance-load report types" do
expect(Puppet::Reports.instance_loader(:report)).to be_instance_of(Puppet::Util::Autoload)
end
it "should have a method for registering report types" do
expect(Puppet::Reports).to respon... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/data_binding_spec.rb | spec/unit/data_binding_spec.rb | require 'spec_helper'
require 'puppet/data_binding'
describe Puppet::DataBinding do
describe "when indirecting" do
it "should default to the 'hiera' data_binding terminus" do
Puppet::DataBinding.indirection.reset_terminus_class
expect(Puppet::DataBinding.indirection.terminus_class).to eq(:hiera)
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/etc_spec.rb | spec/unit/etc_spec.rb | require 'puppet'
require 'spec_helper'
require 'puppet_spec/character_encoding'
# The Ruby::Etc module is largely non-functional on Windows - many methods
# simply return nil regardless of input, the Etc::Group struct is not defined,
# and Etc::Passwd is missing fields
# We want to test that:
# - We correctly set exte... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/task_spec.rb | spec/unit/task_spec.rb | require 'spec_helper'
require 'puppet_spec/files'
require 'puppet_spec/modules'
require 'puppet/module/task'
describe Puppet::Module::Task do
include PuppetSpec::Files
let(:modpath) { tmpdir('task_modpath') }
let(:mymodpath) { File.join(modpath, 'mymod') }
let(:othermodpath) { File.join(modpath, 'othermod') }... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/puppet_pal_2pec.rb | spec/unit/puppet_pal_2pec.rb | require 'spec_helper'
require 'puppet_spec/files'
require 'puppet_pal'
describe 'Puppet Pal' do
include PuppetSpec::Files
let(:testing_env) do
{
'pal_env' => {
'functions' => functions,
'lib' => { 'puppet' => lib_puppet },
'manifests' => manifests,
'modules' => modules,
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | true |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/module_tool_spec.rb | spec/unit/module_tool_spec.rb | # encoding: UTF-8
require 'spec_helper'
require 'puppet/module_tool'
describe Puppet::ModuleTool do
describe '.is_module_root?' do
it 'should return true if directory has a metadata.json file' do
expect(FileTest).to receive(:file?).with(have_attributes(to_s: '/a/b/c/metadata.json')).and_return(true)
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/application_spec.rb | spec/unit/application_spec.rb | require 'spec_helper'
require 'puppet/application'
require 'puppet'
require 'getoptlong'
require 'timeout'
describe Puppet::Application do
before(:each) do
@appclass = Class.new(Puppet::Application) do
def handle_unknown(opt, arg); end
end
@app = @appclass.new
allow(@app).to receive(:name).an... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/transaction_spec.rb | spec/unit/transaction_spec.rb | require 'spec_helper'
require 'matchers/include_in_order'
require 'puppet_spec/compiler'
require 'puppet/transaction'
require 'fileutils'
describe Puppet::Transaction do
include PuppetSpec::Files
include PuppetSpec::Compiler
def catalog_with_resource(resource)
catalog = Puppet::Resource::Catalog.new
ca... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | true |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/defaults_spec.rb | spec/unit/defaults_spec.rb | require 'spec_helper'
require 'puppet/settings'
describe "Defaults" do
describe ".default_diffargs" do
it "should be '-u'" do
expect(Puppet.default_diffargs).to eq("-u")
end
end
describe 'strict' do
it 'should accept the valid value :off' do
expect {Puppet.settings[:strict] = 'off'}.to_n... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/puppet_pal_spec.rb | spec/unit/puppet_pal_spec.rb | require 'spec_helper'
require 'puppet_spec/files'
require_relative 'puppet_pal_2pec'
| ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/datatypes_spec.rb | spec/unit/datatypes_spec.rb | require 'spec_helper'
require 'puppet_spec/compiler'
require 'puppet_spec/files'
require 'puppet/pops'
module PuppetSpec::DataTypes
describe "Puppet::DataTypes" do
include PuppetSpec::Compiler
include PuppetSpec::Files
let(:modules) { { 'mytest' => mytest } }
let(:datatypes) { {} }
let(:environments_dir) { ... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/parameter_spec.rb | spec/unit/parameter_spec.rb | require 'spec_helper'
require 'puppet/parameter'
describe Puppet::Parameter do
before do
@class = Class.new(Puppet::Parameter) do
@name = :foo
end
@class.initvars
@resource = double('resource')
allow(@resource).to receive(:expects)
allow(@resource).to receive(:pathbuilder)
@paramet... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/resource_spec.rb | spec/unit/resource_spec.rb | require 'spec_helper'
require 'puppet/resource'
describe Puppet::Resource do
include PuppetSpec::Files
let(:basepath) { make_absolute("/somepath") }
let(:environment) { Puppet::Node::Environment.create(:testing, []) }
def expect_lookup(key, options = {})
expectation = receive(:unchecked_key_lookup).with(... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | true |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/node_spec.rb | spec/unit/node_spec.rb | require 'spec_helper'
require 'matchers/json'
require 'puppet_spec/files'
describe Puppet::Node do
include JSONMatchers
include PuppetSpec::Files
let(:environment) { Puppet::Node::Environment.create(:bar, []) }
let(:env_loader) { Puppet::Environments::Static.new(environment) }
describe "when managing its e... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/x509/pem_store_spec.rb | spec/unit/x509/pem_store_spec.rb | # coding: utf-8
require 'spec_helper'
require 'puppet/x509'
class Puppet::X509::TestPemStore
include Puppet::X509::PemStore
end
describe Puppet::X509::PemStore do
include PuppetSpec::Files
let(:subject) { Puppet::X509::TestPemStore.new }
def with_unreadable_file
path = tmpfile('pem_store')
Puppet::F... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/x509/cert_provider_spec.rb | spec/unit/x509/cert_provider_spec.rb | require 'spec_helper'
require 'puppet/x509'
describe Puppet::X509::CertProvider do
include PuppetSpec::Files
def create_provider(options)
described_class.new(**options)
end
def expects_public_file(path)
if Puppet::Util::Platform.windows?
current_sid = Puppet::Util::Windows::SID.name_to_sid(Pupp... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/profiler_spec.rb | spec/unit/util/profiler_spec.rb | require 'spec_helper'
require 'puppet/util/profiler'
describe Puppet::Util::Profiler do
let(:profiler) { TestProfiler.new() }
it "supports adding profilers" do
subject.add_profiler(profiler)
expect(subject.current[0]).to eq(profiler)
end
it "supports removing profilers" do
subject.add_profiler(pr... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/splayer_spec.rb | spec/unit/util/splayer_spec.rb | require 'spec_helper'
require 'puppet/util/splayer'
describe Puppet::Util::Splayer do
include Puppet::Util::Splayer
let (:subject) { self }
before do
Puppet[:splay] = true
Puppet[:splaylimit] = "10"
end
it "should do nothing if splay is disabled" do
Puppet[:splay] = false
expect(subject).n... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/monkey_patches_spec.rb | spec/unit/util/monkey_patches_spec.rb | require 'spec_helper'
require 'puppet/util/monkey_patches'
describe Dir do
describe '.exists?' do
it 'returns false if the directory does not exist' do
expect(Dir.exists?('/madeupdirectory')).to be false
end
it 'returns true if the directory exists' do
expect(Dir.exists?(__dir__)).to be tru... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/rpm_compare_spec.rb | spec/unit/util/rpm_compare_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'puppet/util/rpm_compare'
describe Puppet::Util::RpmCompare do
class RpmTest
extend Puppet::Util::RpmCompare
end
describe '.rpmvercmp' do
# test cases munged directly from rpm's own
# tests/rpmvercmp.at
it { expect(RpmTest.rpmvercmp('1... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/terminal_spec.rb | spec/unit/util/terminal_spec.rb | require 'spec_helper'
require 'puppet/util/terminal'
describe Puppet::Util::Terminal do
describe '.width' do
before { allow(Puppet.features).to receive(:posix?).and_return(true) }
it 'should invoke `stty` and return the width' do
height, width = 100, 200
expect(subject).to receive(:`).with('stty... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/at_fork_spec.rb | spec/unit/util/at_fork_spec.rb | require 'spec_helper'
describe 'Puppet::Util::AtFork' do
EXPECTED_HANDLER_METHODS = [:prepare, :parent, :child]
before :each do
Puppet::Util.class_exec do
remove_const(:AtFork) if defined?(Puppet::Util::AtFork)
const_set(:AtFork, Module.new)
end
end
after :each do
Puppet::Util.class_e... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/retry_action_spec.rb | spec/unit/util/retry_action_spec.rb | require 'spec_helper'
require 'puppet/util/retry_action'
describe Puppet::Util::RetryAction do
let (:exceptions) { [ Puppet::Error, NameError ] }
it "doesn't retry SystemExit" do
expect do
Puppet::Util::RetryAction.retry_action( :retries => 0 ) do
raise SystemExit
end
end.to exit_with... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/suidmanager_spec.rb | spec/unit/util/suidmanager_spec.rb | require 'spec_helper'
describe Puppet::Util::SUIDManager do
let :user do
Puppet::Type.type(:user).new(:name => 'name', :uid => 42, :gid => 42)
end
let :xids do
Hash.new {|h,k| 0}
end
before :each do
allow(Puppet::Util::SUIDManager).to receive(:convert_xid).and_return(42)
pwent = double('pwe... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/inifile_spec.rb | spec/unit/util/inifile_spec.rb | require 'spec_helper'
require 'puppet/util/inifile'
describe Puppet::Util::IniConfig::Section do
subject { described_class.new('testsection', '/some/imaginary/file') }
describe "determining if the section is dirty" do
it "is not dirty on creation" do
expect(subject).to_not be_dirty
end
it "is ... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/reference_spec.rb | spec/unit/util/reference_spec.rb | require 'spec_helper'
require 'puppet/util/reference'
describe Puppet::Util::Reference do
it "should create valid Markdown extension definition lists" do
my_fragment = nil
Puppet::Util::Reference.newreference :testreference, :doc => "A peer of the type and configuration references, but with no useful informa... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/posix_spec.rb | spec/unit/util/posix_spec.rb | require 'spec_helper'
require 'puppet/ffi/posix'
require 'puppet/util/posix'
class PosixTest
include Puppet::Util::POSIX
end
describe Puppet::Util::POSIX do
before do
@posix = PosixTest.new
end
describe '.groups_of' do
let(:mock_user_data) { double(user, :gid => 1000) }
let(:ngroups_ptr) { dou... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/watcher_spec.rb | spec/unit/util/watcher_spec.rb | require 'spec_helper'
require 'puppet/util/watcher'
describe Puppet::Util::Watcher do
describe "the common file ctime watcher" do
FakeStat = Struct.new(:ctime)
def ctime(time)
FakeStat.new(time)
end
let(:filename) { "fake" }
it "is initially unchanged" do
expect(Puppet::FileSystem... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/package_spec.rb | spec/unit/util/package_spec.rb | require 'spec_helper'
require 'puppet/util/package'
describe Puppet::Util::Package, " versioncmp" do
it "should be able to be used as a module function" do
expect(Puppet::Util::Package).to respond_to(:versioncmp)
end
it "should be able to sort a long set of various unordered versions" do
ary = %w{ 1.1... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/colors_spec.rb | spec/unit/util/colors_spec.rb | require 'spec_helper'
describe Puppet::Util::Colors do
include Puppet::Util::Colors
let (:message) { 'a message' }
let (:color) { :black }
let (:subject) { self }
describe ".console_color" do
it { is_expected.to respond_to :console_color }
it "should generate ANSI escape sequences" do
expect... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/tag_set_spec.rb | spec/unit/util/tag_set_spec.rb | require 'spec_helper'
require 'puppet/util/tag_set'
RSpec::Matchers.define :be_one_of do |*expected|
match do |actual|
expected.include? actual
end
failure_message do |actual|
"expected #{actual.inspect} to be one of #{expected.map(&:inspect).join(' or ')}"
end
end
describe Puppet::Util::TagSet do
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/selinux_spec.rb | spec/unit/util/selinux_spec.rb | require 'spec_helper'
require 'pathname'
require 'puppet/util/selinux'
describe Puppet::Util::SELinux do
include Puppet::Util::SELinux
let(:selinux) { double('selinux', is_selinux_enabled: 0) }
before :each do
stub_const('Selinux', selinux)
end
describe "selinux_support?" do
it "should return tru... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/plist_spec.rb | spec/unit/util/plist_spec.rb | # coding: utf-8
require 'spec_helper'
require 'puppet/util/plist'
require 'puppet_spec/files'
describe Puppet::Util::Plist, :if => Puppet.features.cfpropertylist? do
include PuppetSpec::Files
let(:valid_xml_plist) do
'<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/network_device_spec.rb | spec/unit/util/network_device_spec.rb | require 'spec_helper'
require 'ostruct'
require 'puppet/util/network_device'
describe Puppet::Util::NetworkDevice do
before(:each) do
@device = OpenStruct.new(:name => "name", :provider => "test", :url => "telnet://admin:password@127.0.0.1", :options => { :debug => false })
end
after(:each) do
Puppet::... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/symbolic_file_mode_spec.rb | spec/unit/util/symbolic_file_mode_spec.rb | require 'spec_helper'
require 'puppet/util/symbolic_file_mode'
describe Puppet::Util::SymbolicFileMode do
include Puppet::Util::SymbolicFileMode
describe "#valid_symbolic_mode?" do
%w{
0 0000 1 1 7 11 77 111 777 11
0 00000 01 01 07 011 077 0111 0777 011
= - + u= g= o= a= u... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/logging_spec.rb | spec/unit/util/logging_spec.rb | require 'spec_helper'
require 'puppet/util/logging'
Puppet::Type.newtype(:logging_test) do
newparam(:name, isnamevar: true)
newproperty(:path)
end
Puppet::Type.type(:logging_test).provide(:logging_test) do
end
class LoggingTester
include Puppet::Util::Logging
end
class PuppetStackCreator
def raise_error(exc... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/autoload_spec.rb | spec/unit/util/autoload_spec.rb | require 'spec_helper'
require 'fileutils'
require 'puppet/util/autoload'
describe Puppet::Util::Autoload do
include PuppetSpec::Files
let(:env) { Puppet::Node::Environment.create(:foo, []) }
before do
@autoload = Puppet::Util::Autoload.new("foo", "tmp")
@loaded = {}
allow(@autoload.class).to rece... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/json_lockfile_spec.rb | spec/unit/util/json_lockfile_spec.rb | require 'spec_helper'
require 'puppet/util/json_lockfile'
describe Puppet::Util::JsonLockfile do
require 'puppet_spec/files'
include PuppetSpec::Files
before(:each) do
@lockfile = tmpfile("lock")
@lock = Puppet::Util::JsonLockfile.new(@lockfile)
end
describe "#lock" do
it "should create a lock... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/tagging_spec.rb | spec/unit/util/tagging_spec.rb | # coding: utf-8
require 'spec_helper'
require 'puppet/util/tagging'
describe Puppet::Util::Tagging do
let(:tagger) { Object.new.extend(Puppet::Util::Tagging) }
it "should add tags to the returned tag list" do
tagger.tag("one")
expect(tagger.tags).to include("one")
end
it "should add all provided tag... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/constant_inflector_spec.rb | spec/unit/util/constant_inflector_spec.rb | require 'spec_helper'
require 'puppet/util/constant_inflector'
describe Puppet::Util::ConstantInflector, "when converting file names to constants" do
it "should capitalize terms" do
expect(subject.file2constant("file")).to eq("File")
end
it "should switch all '/' characters to double colons" do
expect(... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/pidlock_spec.rb | spec/unit/util/pidlock_spec.rb | require 'spec_helper'
require 'puppet/util/pidlock'
describe Puppet::Util::Pidlock, if: !Puppet::Util::Platform.jruby? do
require 'puppet_spec/files'
include PuppetSpec::Files
before(:each) do
@lockfile = tmpfile("lock")
@lock = Puppet::Util::Pidlock.new(@lockfile)
allow(Facter).to receive(:value).... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/user_attr_spec.rb | spec/unit/util/user_attr_spec.rb | require 'spec_helper'
require 'puppet/util/user_attr'
describe UserAttr do
before do
user_attr = ["foo::::type=role", "bar::::type=normal;profile=foobar"]
allow(File).to receive(:readlines).and_return(user_attr)
end
describe "when getting attributes by name" do
it "should return nil if there is no ... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/diff_spec.rb | spec/unit/util/diff_spec.rb | require 'spec_helper'
require 'puppet/util/diff'
require 'puppet/util/execution'
describe Puppet::Util::Diff do
let(:baz_output) { Puppet::Util::Execution::ProcessOutput.new('baz', 0) }
describe ".diff" do
it "should execute the diff command with arguments" do
Puppet[:diff] = 'foo'
Puppet[:diff_ar... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/multi_match_spec.rb | spec/unit/util/multi_match_spec.rb | require 'spec_helper'
require 'puppet/util/multi_match'
describe "The Puppet::Util::MultiMatch" do
let(:not_nil) { Puppet::Util::MultiMatch::NOT_NIL }
let(:mm) { Puppet::Util::MultiMatch }
it "matches against not nil" do
expect(not_nil === 3).to be(true)
end
it "matches against multiple values" do
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/rdoc_spec.rb | spec/unit/util/rdoc_spec.rb | require 'spec_helper'
require 'puppet/util/rdoc'
require 'rdoc/rdoc'
describe Puppet::Util::RDoc do
describe "when generating RDoc HTML documentation" do
before :each do
@rdoc = double('rdoc')
allow(RDoc::RDoc).to receive(:new).and_return(@rdoc)
end
it "should tell RDoc to generate document... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/run_mode_spec.rb | spec/unit/util/run_mode_spec.rb | require 'spec_helper'
describe Puppet::Util::RunMode do
before do
@run_mode = Puppet::Util::RunMode.new('fake')
end
describe Puppet::Util::UnixRunMode, :unless => Puppet::Util::Platform.windows? do
before do
@run_mode = Puppet::Util::UnixRunMode.new('fake')
end
describe "#conf_dir" do
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/backups_spec.rb | spec/unit/util/backups_spec.rb | require 'spec_helper'
require 'puppet/util/backups'
describe Puppet::Util::Backups do
include PuppetSpec::Files
let(:bucket) { double('bucket', :name => "foo") }
let!(:file) do
f = Puppet::Type.type(:file).new(:name => path, :backup => 'foo')
allow(f).to receive(:bucket).and_return(bucket)
f
end
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/execution_stub_spec.rb | spec/unit/util/execution_stub_spec.rb | require 'spec_helper'
describe Puppet::Util::ExecutionStub do
it "should use the provided stub code when 'set' is called" do
Puppet::Util::ExecutionStub.set do |command, options|
expect(command).to eq(['/bin/foo', 'bar'])
"stub output"
end
expect(Puppet::Util::ExecutionStub.current_value).not... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/character_encoding_spec.rb | spec/unit/util/character_encoding_spec.rb | require 'spec_helper'
require 'puppet/util/character_encoding'
require 'puppet_spec/character_encoding'
describe Puppet::Util::CharacterEncoding do
describe "::convert_to_utf_8" do
context "when passed a string that is already UTF-8" do
context "with valid encoding" do
let(:utf8_string) { "\u06FF\u... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/windows_spec.rb | spec/unit/util/windows_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Puppet::Util::Windows do
%w[
ADSI
ADSI::ADSIObject
ADSI::User
ADSI::UserProfile
ADSI::Group
EventLog
File
Process
Registry
Service
SID
].each do |name|
it "defines Puppet::Util::Windows::#{name}" do
... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/metric_spec.rb | spec/unit/util/metric_spec.rb | require 'spec_helper'
require 'puppet/util/metric'
describe Puppet::Util::Metric do
before do
@metric = Puppet::Util::Metric.new("foo")
end
[:type, :name, :value, :label].each do |name|
it "should have a #{name} attribute" do
expect(@metric).to respond_to(name)
expect(@metric).to respond_to... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/docs_spec.rb | spec/unit/util/docs_spec.rb | require 'spec_helper'
describe Puppet::Util::Docs do
describe '.scrub' do
let(:my_cleaned_output) do
%q{This resource type uses the prescribed native tools for creating
groups and generally uses POSIX APIs for retrieving information
about them. It does not directly modify `/etc/passwd` or anything.
* Ju... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/warnings_spec.rb | spec/unit/util/warnings_spec.rb | require 'spec_helper'
describe Puppet::Util::Warnings do
before(:all) do
@msg1 = "booness"
@msg2 = "more booness"
end
before(:each) do
Puppet.debug = true
end
after (:each) do
Puppet.debug = false
end
{:notice => "notice_once", :warning => "warnonce", :debug => "debug_once"}.each do |l... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | false |
puppetlabs/puppet | https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/spec/unit/util/execution_spec.rb | spec/unit/util/execution_spec.rb | # encoding: UTF-8
require 'spec_helper'
require 'puppet/file_system/uniquefile'
require 'puppet_spec/character_encoding'
describe Puppet::Util::Execution, if: !Puppet::Util::Platform.jruby? do
include Puppet::Util::Execution
# utility methods to help us test some private methods without being quite so verbose
d... | ruby | Apache-2.0 | e227c27540975c25aa22d533a52424a9d2fc886a | 2026-01-04T15:39:26.576514Z | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.