source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/rpm_compare_spec.rb | Ruby | apache-2.0 | 7,843 | main | 8,876 | # 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/diff_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,475 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/symbolic_file_mode_spec.rb | Ruby | apache-2.0 | 7,843 | main | 6,230 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/metric_spec.rb | Ruby | apache-2.0 | 7,843 | main | 2,560 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/inifile_spec.rb | Ruby | apache-2.0 | 7,843 | main | 14,827 | 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 ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/yaml_spec.rb | Ruby | apache-2.0 | 7,843 | main | 5,114 | # coding: utf-8
require 'spec_helper'
require 'puppet/util/yaml'
describe Puppet::Util::Yaml do
include PuppetSpec::Files
let(:filename) { tmpfile("yaml") }
shared_examples_for 'yaml file loader' do |load_method|
it 'returns false when the file is empty' do
file_path = file_containing('input', '')
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/plist_spec.rb | Ruby | apache-2.0 | 7,843 | main | 8,273 | # 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/reference_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,510 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/pidlock_spec.rb | Ruby | apache-2.0 | 7,843 | main | 10,771 | 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).... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/warnings_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,210 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/rubygems_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,642 | require 'spec_helper'
require 'puppet/util/rubygems'
describe Puppet::Util::RubyGems::Source do
let(:gem_path) { File.expand_path('/foo/gems') }
let(:gem_lib) { File.join(gem_path, 'lib') }
let(:fake_gem) { double(:full_gem_path => gem_path) }
describe "::new" do
it "returns NoGemsSource if rubygems is no... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/retry_action_spec.rb | Ruby | apache-2.0 | 7,843 | main | 2,573 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/run_mode_spec.rb | Ruby | apache-2.0 | 7,843 | main | 9,585 | 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
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/character_encoding_spec.rb | Ruby | apache-2.0 | 7,843 | main | 8,347 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/rdoc_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,786 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/windows_spec.rb | Ruby | apache-2.0 | 7,843 | main | 386 | # 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
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/watched_file_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,603 | require 'spec_helper'
require 'puppet/util/watched_file'
require 'puppet/util/watcher'
describe Puppet::Util::WatchedFile do
let(:an_absurdly_long_timeout) { Puppet::Util::Watcher::Timer.new(100000) }
let(:an_immediate_timeout) { Puppet::Util::Watcher::Timer.new(0) }
it "acts like a string so that it can be use... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/errors_spec.rb | Ruby | apache-2.0 | 7,843 | main | 892 | require 'spec_helper'
require 'puppet/util/errors'
class ErrorTester
include Puppet::Util::Errors
attr_accessor :line, :file
end
describe Puppet::Util::Errors do
before do
@tester = ErrorTester.new
end
it "should provide a 'fail' method" do
expect(@tester).to respond_to(:fail)
end
it "should ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/log_spec.rb | Ruby | apache-2.0 | 7,843 | main | 17,388 | # coding: utf-8
require 'spec_helper'
require 'puppet/util/log'
describe Puppet::Util::Log do
include PuppetSpec::Files
def log_notice(message)
Puppet::Util::Log.new(:level => :notice, :message => message)
end
it "should write a given message to the specified destination" do
arraydest = []
Puppe... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/command_line_spec.rb | Ruby | apache-2.0 | 7,843 | main | 7,634 | require 'spec_helper'
require 'puppet/face'
require 'puppet/util/command_line'
describe Puppet::Util::CommandLine do
include PuppetSpec::Files
context "#initialize" do
it "should pull off the first argument if it looks like a subcommand" do
command_line = Puppet::Util::CommandLine.new("puppet", %w{ cli... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/monkey_patches_spec.rb | Ruby | apache-2.0 | 7,843 | main | 4,433 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/tagging_spec.rb | Ruby | apache-2.0 | 7,843 | main | 6,828 | # 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/resource_template_spec.rb | Ruby | apache-2.0 | 7,843 | main | 2,160 | require 'spec_helper'
require 'puppet/util/resource_template'
describe Puppet::Util::ResourceTemplate do
describe "when initializing" do
it "should fail if the template does not exist" do
expect(Puppet::FileSystem).to receive(:exist?).with("/my/template").and_return(false)
expect { Puppet::Util::Res... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/profiler_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,179 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/splayer_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,066 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/user_attr_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,457 | 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 ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/autoload_spec.rb | Ruby | apache-2.0 | 7,843 | main | 12,214 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/at_fork_spec.rb | Ruby | apache-2.0 | 7,843 | main | 5,259 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/package_spec.rb | Ruby | apache-2.0 | 7,843 | main | 704 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/colors_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,191 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/selinux_spec.rb | Ruby | apache-2.0 | 7,843 | main | 24,224 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/skip_tags_spec.rb | Ruby | apache-2.0 | 7,843 | main | 372 | # coding: utf-8
require 'spec_helper'
require 'puppet/util/skip_tags'
describe Puppet::Util::SkipTags do
let(:tagger) { Puppet::Util::SkipTags.new([]) }
it "should add qualified classes as single tags" do
tagger.tag("one::two::three")
expect(tagger.tags).to include("one::two::three")
expect(tagger.ta... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/json_spec.rb | Ruby | apache-2.0 | 7,843 | main | 3,827 | # coding: utf-8
require 'spec_helper'
require 'puppet/util/json'
describe Puppet::Util::Json do
include PuppetSpec::Files
shared_examples_for 'json file loader' do |load_method|
it 'reads a JSON file from disk' do
file_path = file_containing('input', JSON.dump({ "my" => "data" }))
expect(load_met... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/execution_stub_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,526 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/docs_spec.rb | Ruby | apache-2.0 | 7,843 | main | 4,252 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/storage_spec.rb | Ruby | apache-2.0 | 7,843 | main | 10,463 | require 'spec_helper'
require 'yaml'
require 'fileutils'
require 'puppet/util/storage'
describe Puppet::Util::Storage do
include PuppetSpec::Files
before(:each) do
@basepath = File.expand_path("/somepath")
end
describe "when caching a symbol" do
it "should return an empty hash" do
expect(Puppe... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/checksums_spec.rb | Ruby | apache-2.0 | 7,843 | main | 8,148 | require 'spec_helper'
require 'puppet/util/checksums'
describe Puppet::Util::Checksums do
include PuppetSpec::Files
before do
@summer = Puppet::Util::Checksums
end
content_sums = [:md5, :md5lite, :sha1, :sha1lite, :sha256, :sha256lite, :sha512, :sha384, :sha224]
file_only = [:ctime, :mtime, :none]
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/posix_spec.rb | Ruby | apache-2.0 | 7,843 | main | 24,711 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/feature_spec.rb | Ruby | apache-2.0 | 7,843 | main | 4,425 | require 'spec_helper'
require 'puppet/util/feature'
describe Puppet::Util::Feature do
before do
@features = Puppet::Util::Feature.new("features")
allow(@features).to receive(:warn)
end
it "should not call associated code when adding a feature" do
$loaded_feature = false
@features.add(:myfeature... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/multi_match_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,107 | 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
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/profiler/wall_clock_spec.rb | Ruby | apache-2.0 | 7,843 | main | 408 | require 'spec_helper'
require 'puppet/util/profiler'
describe Puppet::Util::Profiler::WallClock do
it "logs the number of seconds it took to execute the segment" do
profiler = Puppet::Util::Profiler::WallClock.new(nil, nil)
message = profiler.do_finish(profiler.start(["foo", "bar"], "Testing"), ["foo", "ba... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/profiler/logging_spec.rb | Ruby | apache-2.0 | 7,843 | main | 2,041 | require 'spec_helper'
require 'puppet/util/profiler'
describe Puppet::Util::Profiler::Logging do
let(:logger) { SimpleLog.new }
let(:identifier) { "Profiling ID" }
let(:logging_profiler) { TestLoggingProfiler.new(logger, identifier) }
let(:profiler) do
p = Puppet::Util::Profiler::AroundProfiler.new
p.a... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/profiler/object_counts_spec.rb | Ruby | apache-2.0 | 7,843 | main | 424 | require 'spec_helper'
require 'puppet/util/profiler'
describe Puppet::Util::Profiler::ObjectCounts, unless: Puppet::Util::Platform.jruby? do
# ObjectSpace is not enabled by default on JRuby
it "reports the changes in the system object counts" do
profiler = Puppet::Util::Profiler::ObjectCounts.new(nil, nil)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/profiler/around_profiler_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,604 | require 'spec_helper'
require 'puppet/util/profiler'
describe Puppet::Util::Profiler::AroundProfiler do
let(:child) { TestAroundProfiler.new() }
let(:profiler) { Puppet::Util::Profiler::AroundProfiler.new }
before :each do
profiler.add_profiler(child)
end
it "returns the value of the profiled segment" ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/profiler/aggregate_spec.rb | Ruby | apache-2.0 | 7,843 | main | 2,258 | require 'spec_helper'
require 'puppet/util/profiler'
require 'puppet/util/profiler/around_profiler'
require 'puppet/util/profiler/aggregate'
describe Puppet::Util::Profiler::Aggregate do
let(:logger) { AggregateSimpleLog.new }
let(:profiler) { Puppet::Util::Profiler::Aggregate.new(logger, nil) }
let(:profiler_mg... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/command_line_utils/puppet_option_parser_spec.rb | Ruby | apache-2.0 | 7,843 | main | 7,830 | require 'spec_helper'
require 'puppet/util/command_line/puppet_option_parser'
describe Puppet::Util::CommandLine::PuppetOptionParser do
let(:option_parser) { described_class.new }
describe "an option with a value" do
it "parses a 'long' option with a value" do
parses(
:option => ["--angry", "Ang... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/network_device/config_spec.rb | Ruby | apache-2.0 | 7,843 | main | 2,759 | require 'spec_helper'
require 'puppet/util/network_device/config'
describe Puppet::Util::NetworkDevice::Config do
include PuppetSpec::Files
before(:each) do
Puppet[:deviceconfig] = tmpfile('deviceconfig')
end
describe "when parsing device" do
let(:config) { Puppet::Util::NetworkDevice::Config.new }
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/network_device/transport/base_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,262 | require 'spec_helper'
require 'puppet/util/network_device/transport/base'
describe Puppet::Util::NetworkDevice::Transport::Base do
class TestTransport < Puppet::Util::NetworkDevice::Transport::Base
end
before(:each) do
@transport = TestTransport.new
end
describe "when sending commands" do
it "shou... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/windows/service_spec.rb | Ruby | apache-2.0 | 7,843 | main | 29,987 | require 'spec_helper'
describe "Puppet::Util::Windows::Service", :if => Puppet.features.microsoft_windows? do
require 'puppet/util/windows'
before(:each) do
allow(Puppet::Util::Windows::Error).to receive(:format_error_code)
.with(anything)
.and_return("fake error!")
end
def service_state_str(... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/windows/security_descriptor_spec.rb | Ruby | apache-2.0 | 7,843 | main | 3,878 | require 'spec_helper'
require 'puppet/util/windows'
describe "Puppet::Util::Windows::SecurityDescriptor", :if => Puppet::Util::Platform.windows? do
let(:system_sid) { Puppet::Util::Windows::SID::LocalSystem }
let(:admins_sid) { Puppet::Util::Windows::SID::BuiltinAdministrators }
let(:group_sid) { Puppet::Util::W... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/windows/root_certs_spec.rb | Ruby | apache-2.0 | 7,843 | main | 465 | require 'spec_helper'
require 'puppet/util/windows'
describe "Puppet::Util::Windows::RootCerts", :if => Puppet::Util::Platform.windows? do
let(:x509_store) { Puppet::Util::Windows::RootCerts.instance.to_a }
it "should return at least one X509 certificate" do
expect(x509_store.to_a.size).to be >= 1
end
it... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/windows/api_types_spec.rb | Ruby | apache-2.0 | 7,843 | main | 7,267 | # encoding: UTF-8
require 'spec_helper'
describe "FFI::MemoryPointer", :if => Puppet::Util::Platform.windows? do
# use 2 bad bytes at end so we have even number of bytes / characters
let(:bad_string) { "hello invalid world".encode(Encoding::UTF_16LE) + "\xDD\xDD".force_encoding(Encoding::UTF_16LE) }
let(:bad_st... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/windows/access_control_list_spec.rb | Ruby | apache-2.0 | 7,843 | main | 4,047 | require 'spec_helper'
require 'puppet/util/windows'
describe "Puppet::Util::Windows::AccessControlList", :if => Puppet::Util::Platform.windows? do
let(:klass) { Puppet::Util::Windows::AccessControlList }
let(:system_sid) { 'S-1-5-18' }
let(:admins_sid) { 'S-1-5-544' }
let(:none_sid) { 'S-1-0-0' }
let(:sys... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/windows/eventlog_spec.rb | Ruby | apache-2.0 | 7,843 | main | 5,558 | require 'spec_helper'
require 'puppet/util/windows'
describe Puppet::Util::Windows::EventLog, :if => Puppet::Util::Platform.windows? do
before(:each) { @event_log = Puppet::Util::Windows::EventLog.new }
after(:each) { @event_log.close }
describe "class constants" do
it "should define NULL_HANDLE as 0" do
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/windows/sid_spec.rb | Ruby | apache-2.0 | 7,843 | main | 14,358 | require 'spec_helper'
describe "Puppet::Util::Windows::SID", :if => Puppet::Util::Platform.windows? do
if Puppet::Util::Platform.windows?
require 'puppet/util/windows'
end
let(:subject) { Puppet::Util::Windows::SID }
let(:sid) { Puppet::Util::Windows::SID::LocalSystem }
let(:invalid_sid) ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/windows/string_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,554 | # encoding: UTF-8
require 'spec_helper'
require 'puppet/util/windows'
describe "Puppet::Util::Windows::String", :if => Puppet::Util::Platform.windows? do
def wide_string(str)
Puppet::Util::Windows::String.wide_string(str)
end
def converts_to_wide_string(string_value)
expected = string_value.encode(Enco... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/windows/access_control_entry_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,828 | require 'spec_helper'
require 'puppet/util/windows'
describe "Puppet::Util::Windows::AccessControlEntry", :if => Puppet::Util::Platform.windows? do
let(:klass) { Puppet::Util::Windows::AccessControlEntry }
let(:sid) { 'S-1-5-18' }
let(:mask) { Puppet::Util::Windows::File::FILE_ALL_ACCESS }
it "creates an acce... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/windows/file_spec.rb | Ruby | apache-2.0 | 7,843 | main | 3,474 | require 'spec_helper'
require 'puppet/util/windows'
describe Puppet::Util::Windows::File, :if => Puppet::Util::Platform.windows? do
include PuppetSpec::Files
let(:nonexist_file) { 'C:\foo.bar' }
let(:nonexist_path) { 'C:\somefile\that\wont\ever\exist' }
let(:invalid_file_attributes) { 0xFFFFFFFF } #define INV... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/windows/adsi_spec.rb | Ruby | apache-2.0 | 7,843 | main | 32,021 | require 'spec_helper'
require 'puppet/util/windows'
describe Puppet::Util::Windows::ADSI, :if => Puppet::Util::Platform.windows? do
let(:connection) { double('connection') }
let(:builtin_localized) { Puppet::Util::Windows::SID.sid_to_name('S-1-5-32') }
# SYSTEM is special as English can retrieve it via Windows ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/ldap/generator_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,450 | require 'spec_helper'
require 'puppet/util/ldap/generator'
describe Puppet::Util::Ldap::Generator do
before do
@generator = Puppet::Util::Ldap::Generator.new(:uno)
end
it "should require a parameter name at initialization" do
expect { Puppet::Util::Ldap::Generator.new }.to raise_error(ArgumentError, /w... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/ldap/manager_spec.rb | Ruby | apache-2.0 | 7,843 | main | 22,588 | require 'spec_helper'
require 'puppet/util/ldap/manager'
describe Puppet::Util::Ldap::Manager, :if => Puppet.features.ldap? do
before do
@manager = Puppet::Util::Ldap::Manager.new
end
it "should return self when specifying objectclasses" do
expect(@manager.manages(:one, :two)).to equal(@manager)
end
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/ldap/connection_spec.rb | Ruby | apache-2.0 | 7,843 | main | 5,474 | require 'spec_helper'
require 'puppet/util/ldap/connection'
# So our mocks and such all work, even when ldap isn't available.
unless Puppet.features.ldap?
class LDAP
class Conn
def initialize(*args)
end
end
class SSLConn < Conn; end
LDAP_OPT_PROTOCOL_VERSION = 1
LDAP_OPT_REFERRALS =... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/watcher/periodic_watcher_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,660 | require 'spec_helper'
require 'puppet/util/watcher'
describe Puppet::Util::Watcher::PeriodicWatcher do
let(:enabled_timeout) { 1 }
let(:disabled_timeout) { -1 }
let(:a_value) { 15 }
let(:a_different_value) { 16 }
let(:unused_watcher) { double('unused watcher') }
let(:unchanged_watcher) { a_watcher_report... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/package/version/pip_spec.rb | Ruby | apache-2.0 | 7,843 | main | 18,616 | require 'spec_helper'
require 'puppet/util/package/version/pip'
describe Puppet::Util::Package::Version::Pip do
describe "initialization" do
shared_examples_for 'a valid version' do |input_version, output = input_version|
[input_version, input_version.swapcase].each do |input|
it "transforms #{inpu... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/package/version/range_spec.rb | Ruby | apache-2.0 | 7,843 | main | 6,180 | require 'spec_helper'
require 'puppet/util/package/version/range'
class IntegerVersion
class ValidationFailure < ArgumentError; end
include Comparable
REGEX_FULL = '(\d+)'.freeze
REGEX_FULL_RX = /\A#{REGEX_FULL}\Z/.freeze
def self.parse(ver)
match, version = *ver.match(REGEX_FULL_RX)
raise Valida... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/package/version/debian_spec.rb | Ruby | apache-2.0 | 7,843 | main | 3,083 | require 'spec_helper'
require 'puppet/util/package/version/debian'
describe Puppet::Util::Package::Version::Debian do
context "when creating new version should fail" do
it "if is parsing symbols" do
expect { described_class.parse(:absent) }.to raise_error(described_class::ValidationFailure)
end
end
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/util/package/version/rpm_spec.rb | Ruby | apache-2.0 | 7,843 | main | 4,015 | require 'spec_helper'
require 'puppet/util/package/version/rpm'
describe Puppet::Util::Package::Version::Rpm do
context "when parsing an invalid version" do
it "raises ArgumentError" do
expect { described_class.parse(:absent)}.to raise_error(ArgumentError)
end
end
context "when creating new versi... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/gettext/module_loading_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,664 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/gettext/config_spec.rb | Ruby | apache-2.0 | 7,843 | main | 5,872 | 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... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/hiera/scope_spec.rb | Ruby | apache-2.0 | 7,843 | main | 3,355 | require 'spec_helper'
require 'hiera/scope'
require 'puppet_spec/scope'
describe Hiera::Scope do
include PuppetSpec::Scope
let(:real) { create_test_scope_for_node("test_node") }
let(:scope) { Hiera::Scope.new(real) }
describe "#initialize" do
it "should store the supplied puppet scope" do
expect(s... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parameter/package_options_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,382 | require 'spec_helper'
require 'puppet/parameter/package_options'
describe Puppet::Parameter::PackageOptions do
let (:resource) { double('resource') }
let (:param) { described_class.new(:resource => resource) }
let (:arg) { '/S' }
let (:key) { 'INSTALLDIR' }
let (:value) { 'C:/mydir' }
con... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parameter/boolean_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,079 | require 'spec_helper'
require 'puppet'
require 'puppet/parameter/boolean'
describe Puppet::Parameter::Boolean do
let (:resource) { double('resource') }
describe "after initvars" do
before { described_class.initvars }
it "should have the correct value_collection" do
expect(described_class.value_collec... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parameter/value_spec.rb | Ruby | apache-2.0 | 7,843 | main | 2,679 | require 'spec_helper'
require 'puppet/parameter'
describe Puppet::Parameter::Value do
it "should require a name" do
expect { Puppet::Parameter::Value.new }.to raise_error(ArgumentError)
end
it "should set its name" do
expect(Puppet::Parameter::Value.new(:foo).name).to eq(:foo)
end
it "should suppo... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parameter/value_collection_spec.rb | Ruby | apache-2.0 | 7,843 | main | 5,299 | require 'spec_helper'
require 'puppet/parameter'
describe Puppet::Parameter::ValueCollection do
before do
@collection = Puppet::Parameter::ValueCollection.new
end
it "should have a method for defining new values" do
expect(@collection).to respond_to(:newvalues)
end
it "should have a method for add... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parameter/path_spec.rb | Ruby | apache-2.0 | 7,843 | main | 751 | require 'spec_helper'
require 'puppet/parameter/path'
[false, true].each do |arrays|
describe "Puppet::Parameter::Path with arrays #{arrays}" do
it_should_behave_like "all path parameters", :path, :array => arrays do
# The new type allows us a test that is guaranteed to go direct to our
# validation... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/scheduler/scheduler_spec.rb | Ruby | apache-2.0 | 7,843 | main | 2,521 | require 'spec_helper'
require 'puppet/scheduler'
describe Puppet::Scheduler::Scheduler do
let(:now) { 183550 }
let(:timer) { MockTimer.new(now) }
class MockTimer
attr_reader :wait_for_calls
def initialize(start=1729)
@now = start
@wait_for_calls = []
end
def wait_for(seconds)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/scheduler/job_spec.rb | Ruby | apache-2.0 | 7,843 | main | 2,124 | require 'spec_helper'
require 'puppet/scheduler'
describe Puppet::Scheduler::Job do
let(:run_interval) { 10 }
let(:job) { described_class.new(run_interval) }
it "has a minimum run interval of 0" do
expect(Puppet::Scheduler::Job.new(-1).run_interval).to eq(0)
end
describe "when not run yet" do
it "i... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/scheduler/splay_job_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,449 | require 'spec_helper'
require 'puppet/scheduler'
describe Puppet::Scheduler::SplayJob do
let(:run_interval) { 10 }
let(:last_run) { 50 }
let(:splay_limit) { 5 }
let(:start_time) { 23 }
let(:job) { described_class.new(run_interval, splay_limit) }
it "does not apply a splay after the first run" do
job.r... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/files_spec.rb | Ruby | apache-2.0 | 7,843 | main | 4,165 | require 'spec_helper'
require 'puppet/parser/files'
describe Puppet::Parser::Files do
include PuppetSpec::Files
let(:modulepath) { tmpdir("modulepath") }
let(:environment) { Puppet::Node::Environment.create(:testing, [modulepath]) }
let(:mymod) { File.join(modulepath, "mymod") }
let(:mymod_files) { File.jo... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/relationship_spec.rb | Ruby | apache-2.0 | 7,843 | main | 2,815 | require 'spec_helper'
require 'puppet/parser/relationship'
describe Puppet::Parser::Relationship do
before do
@source = Puppet::Resource.new(:mytype, "source")
@target = Puppet::Resource.new(:mytype, "target")
@extra_resource = Puppet::Resource.new(:mytype, "extra")
@extra_resource2 = Puppet::Resou... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions_spec.rb | Ruby | apache-2.0 | 7,843 | main | 6,753 | require 'spec_helper'
describe Puppet::Parser::Functions do
def callable_functions_from(mod)
Class.new { include mod }.new
end
let(:function_module) { Puppet::Parser::Functions.environment_module(Puppet.lookup(:current_environment)) }
let(:environment) { Puppet::Node::Environment.create(:myenv, []) }
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/compiler_spec.rb | Ruby | apache-2.0 | 7,843 | main | 35,824 | require 'spec_helper'
require 'puppet_spec/compiler'
require 'matchers/resource'
class CompilerTestResource
attr_accessor :builtin, :virtual, :evaluated, :type, :title
def initialize(type, title)
@type = type
@title = title
end
def [](attr)
return nil if (attr == :stage || attr == :alias)
:ma... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/scope_spec.rb | Ruby | apache-2.0 | 7,843 | main | 25,166 | require 'spec_helper'
require 'puppet_spec/compiler'
require 'puppet_spec/scope'
describe Puppet::Parser::Scope do
include PuppetSpec::Scope
before :each do
@scope = Puppet::Parser::Scope.new(
Puppet::Parser::Compiler.new(Puppet::Node.new("foo"))
)
@scope.source = Puppet::Resource::Type.new(:nod... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/type_loader_spec.rb | Ruby | apache-2.0 | 7,843 | main | 7,641 | require 'spec_helper'
require 'puppet/parser/type_loader'
require 'puppet/parser/parser_factory'
require 'puppet_spec/modules'
require 'puppet_spec/files'
describe Puppet::Parser::TypeLoader do
include PuppetSpec::Modules
include PuppetSpec::Files
let(:empty_hostclass) { Puppet::Parser::AST::Hostclass.new('') ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/templatewrapper_spec.rb | Ruby | apache-2.0 | 7,843 | main | 3,684 | require 'spec_helper'
require 'puppet/parser/templatewrapper'
describe Puppet::Parser::TemplateWrapper do
include PuppetSpec::Files
let(:known_resource_types) { Puppet::Resource::TypeCollection.new("env") }
let(:scope) do
compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("mynode"))
allow(compiler... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/resource_spec.rb | Ruby | apache-2.0 | 7,843 | main | 25,047 | require 'spec_helper'
describe Puppet::Parser::Resource do
before do
environment = Puppet::Node::Environment.create(:testing, [])
@node = Puppet::Node.new("yaynode", :environment => environment)
@known_resource_types = environment.known_resource_types
@compiler = Puppet::Parser::Compiler.new(@node)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions/hiera_spec.rb | Ruby | apache-2.0 | 7,843 | main | 396 | require 'spec_helper'
require 'puppet_spec/scope'
describe 'Puppet::Parser::Functions#hiera' do
include PuppetSpec::Scope
let :scope do create_test_scope_for_node('foo') end
it 'should raise an error since this function is converted to 4x API)' do
expect { scope.function_hiera(['key']) }.to raise_error(Pup... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions/versioncmp_spec.rb | Ruby | apache-2.0 | 7,843 | main | 920 | require 'spec_helper'
describe "the versioncmp function" do
before :each do
node = Puppet::Node.new('localhost')
compiler = Puppet::Parser::Compiler.new(node)
@scope = Puppet::Parser::Scope.new(compiler)
end
it "should exist" do
expect(Puppet::Parser::Functions.function("versioncmp")).to e... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions/generate_spec.rb | Ruby | apache-2.0 | 7,843 | main | 6,685 | require 'spec_helper'
def with_executor
return yield unless Puppet::Util::Platform.jruby?
begin
Puppet::Util::ExecutionStub.set do |command, options, stdin, stdout, stderr|
require 'open3'
# simulate what puppetserver does
Dir.chdir(options[:cwd]) do
out, err, _status = Open3.capture... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions/hiera_include_spec.rb | Ruby | apache-2.0 | 7,843 | main | 412 | require 'spec_helper'
require 'puppet_spec/scope'
describe 'Puppet::Parser::Functions#hiera_include' do
include PuppetSpec::Scope
let :scope do create_test_scope_for_node('foo') end
it 'should raise an error since this function is converted to 4x API)' do
expect { scope.function_hiera_include(['key']) }.to... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions/scanf_spec.rb | Ruby | apache-2.0 | 7,843 | main | 737 | require 'spec_helper'
describe "the scanf function" do
let(:node) { Puppet::Node.new('localhost') }
let(:compiler) { Puppet::Parser::Compiler.new(node) }
let(:scope) { Puppet::Parser::Scope.new(compiler) }
it 'scans a value and returns an array' do
expect(scope.function_scanf(['42', '%i'])[0] == 42)
end... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions/lookup_spec.rb | Ruby | apache-2.0 | 7,843 | main | 422 | require 'spec_helper'
require 'puppet/pops'
require 'stringio'
require 'puppet_spec/scope'
describe "lookup function" do
include PuppetSpec::Scope
let :scope do create_test_scope_for_node('foo') end
it 'should raise an error since this function is converted to 4x API)' do
expect { scope.function_lookup(['k... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions/shellquote_spec.rb | Ruby | apache-2.0 | 7,843 | main | 2,281 | require 'spec_helper'
describe "the shellquote function" do
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) end
it "should exist" do
expect(Puppet::Parser::Functions.function("shellquote")).to e... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions/template_spec.rb | Ruby | apache-2.0 | 7,843 | main | 3,422 | require 'spec_helper'
describe "the template function" do
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) end
it "concatenates outputs for multiple templates" do
tw1 = double("template_wrapper1"... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions/file_spec.rb | Ruby | apache-2.0 | 7,843 | main | 3,235 | require 'spec_helper'
require 'puppet_spec/files'
describe "the 'file' 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 Puppet::Parser::Scope.new(compiler) end
def with_file_content(content)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions/realize_spec.rb | Ruby | apache-2.0 | 7,843 | main | 1,809 | require 'spec_helper'
require 'matchers/resource'
require 'puppet_spec/compiler'
describe "the realize function" do
include Matchers::Resource
include PuppetSpec::Compiler
it "realizes a single, referenced resource" do
catalog = compile_to_catalog(<<-EOM)
@notify { testing: }
realize(Notify[test... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions/split_spec.rb | Ruby | apache-2.0 | 7,843 | main | 420 | require 'spec_helper'
describe "the split function" do
before :each do
node = Puppet::Node.new('localhost')
compiler = Puppet::Parser::Compiler.new(node)
@scope = Puppet::Parser::Scope.new(compiler)
end
it 'should raise a ParseError' do
expect { @scope.function_split([ '130;236;254;10', ';... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions/tag_spec.rb | Ruby | apache-2.0 | 7,843 | main | 886 | require 'spec_helper'
describe "the 'tag' function" do
before :each do
node = Puppet::Node.new('localhost')
compiler = Puppet::Parser::Compiler.new(node)
@scope = Puppet::Parser::Scope.new(compiler)
end
it "should exist" do
expect(Puppet::Parser::Functions.function(:tag)).to eq("function_t... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions/fqdn_rand_spec.rb | Ruby | apache-2.0 | 7,843 | main | 3,202 | require 'spec_helper'
require 'puppet_spec/scope'
describe "the fqdn_rand function" do
include PuppetSpec::Scope
it "returns an integer" do
expect(fqdn_rand(3)).to be_an(Integer)
end
it "provides a random number strictly less than the given max" do
expect(fqdn_rand(3)).to satisfy {|n| n < 3 }
end
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | spec/unit/parser/functions/create_resources_spec.rb | Ruby | apache-2.0 | 7,843 | main | 12,627 | require 'puppet'
require 'spec_helper'
require 'puppet_spec/compiler'
require 'puppet_spec/files'
describe 'function for dynamically creating resources' do
include PuppetSpec::Compiler
include PuppetSpec::Files
before :each do
node = Puppet::Node.new("floppy", :environment => 'production')
@compile... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.