puppetlabs_spec_helper-0.10.3/0000755000004100000410000000000012526336057016364 5ustar www-datawww-datapuppetlabs_spec_helper-0.10.3/Rakefile0000644000004100000410000000127112526336057020032 0ustar www-datawww-datarequire 'rake' require 'rake/packagetask' require 'rubygems/package_task' task :default do sh %{rake -T} end require 'fileutils' def version require 'puppetlabs_spec_helper/version' PuppetlabsSpecHelper::Version::STRING end namespace :package do desc "Create the gem" task :gem do spec = Gem::Specification.load("puppetlabs_spec_helper.gemspec") Dir.mkdir("pkg") rescue nil if Gem::Version.new(`gem -v`) >= Gem::Version.new("2.0.0.a") Gem::Package.build(spec) else Gem::Builder.new(spec).build end FileUtils.move("puppetlabs_spec_helper-#{version}.gem", "pkg") end end desc "Cleanup pkg directory" task :clean do FileUtils.rm_rf("pkg") end puppetlabs_spec_helper-0.10.3/Gemfile0000644000004100000410000000021012526336057017650 0ustar www-datawww-datasource :rubygems gemspec if File.exists? "#{__FILE__}.local" eval(File.read("#{__FILE__}.local"), binding) end # vim:filetype=ruby puppetlabs_spec_helper-0.10.3/puppetlabs_spec_helper.rb0000644000004100000410000000043612526336057023444 0ustar www-datawww-data$:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'lib')) require 'puppetlabs_spec_helper/puppetlabs_spec_helper' puts "Using 'PROJECT_ROOT/puppetlabs_spec_helper' is deprecated, please install as a gem and require 'puppetlabs_spec_helper/puppetlabs_spec_helper' instead" puppetlabs_spec_helper-0.10.3/spec/0000755000004100000410000000000012526336057017316 5ustar www-datawww-datapuppetlabs_spec_helper-0.10.3/spec/lib/0000755000004100000410000000000012526336057020064 5ustar www-datawww-datapuppetlabs_spec_helper-0.10.3/spec/lib/puppet/0000755000004100000410000000000012526336057021401 5ustar www-datawww-datapuppetlabs_spec_helper-0.10.3/spec/lib/puppet/type/0000755000004100000410000000000012526336057022362 5ustar www-datawww-datapuppetlabs_spec_helper-0.10.3/spec/lib/puppet/type/spechelper.rb0000644000004100000410000000015012526336057025035 0ustar www-datawww-datarequire 'puppet/type' Puppet::Type.newtype(:spechelper) do @doc = "This is the spechelper type" end puppetlabs_spec_helper-0.10.3/spec/watchr.rb0000644000004100000410000000314112526336057021132 0ustar www-datawww-dataENV['FOG_MOCK'] ||= 'true' ENV['AUTOTEST'] = 'true' ENV['WATCHR'] = '1' system 'clear' def growl(message) growlnotify = `which growlnotify`.chomp title = "Watchr Test Results" image = case message when /(\d+)\s+?(failure|error)/i ($1.to_i == 0) ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png" else '~/.watchr_images/unknown.png' end options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'" system %(#{growlnotify} #{options} &) end def run(cmd) puts(cmd) `#{cmd}` end def run_spec_test(file) if File.exist? file result = run "rspec --format p --color #{file}" growl result.split("\n").last puts result else puts "FIXME: No test #{file} [#{Time.now}]" end end def filter_rspec(data) data.split("\n").find_all do |l| l =~ /^(\d+)\s+exampl\w+.*?(\d+).*?failur\w+.*?(\d+).*?pending/ end.join("\n") end def run_all_tests system('clear') files = Dir.glob("spec/**/*_spec.rb").join(" ") result = run "rspec #{files}" growl_results = filter_rspec result growl growl_results puts result puts "GROWL: #{growl_results}" end # Ctrl-\ Signal.trap 'QUIT' do puts " --- Running all tests ---\n\n" run_all_tests end @interrupted = false # Ctrl-C Signal.trap 'INT' do if @interrupted then @wants_to_quit = true abort("\n") else puts "Interrupt a second time to quit" @interrupted = true Kernel.sleep 1.5 # raise Interrupt, nil # let the run loop catch it run_suite end end watch( 'spec/.*_spec\.rb' ) do |md| run_all_tests end watch( 'lib/.*\.rb' ) do |md| run_all_tests end puppetlabs_spec_helper-0.10.3/spec/unit/0000755000004100000410000000000012526336057020275 5ustar www-datawww-datapuppetlabs_spec_helper-0.10.3/spec/unit/puppetlabs_spec_helper/0000755000004100000410000000000012526336057025025 5ustar www-datawww-datapuppetlabs_spec_helper-0.10.3/spec/unit/puppetlabs_spec_helper/puppetlabs_spec/0000755000004100000410000000000012526336057030216 5ustar www-datawww-data././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootpuppetlabs_spec_helper-0.10.3/spec/unit/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals_spec.rbpuppetlabs_spec_helper-0.10.3/spec/unit/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals_spec0000644000004100000410000000512512526336057034552 0ustar www-datawww-data#! /usr/bin/env ruby -S rspec require 'puppetlabs_spec_helper/puppet_spec_helper' require 'puppetlabs_spec_helper/puppetlabs_spec/puppet_internals' describe PuppetlabsSpec::PuppetInternals do describe ".scope" do it "should return a Puppet::Parser::Scope instance" do subject.scope.should be_a_kind_of Puppet::Parser::Scope end it "should be suitable for function testing" do scope = subject.scope scope.function_split(["one;two", ";"]).should == [ 'one', 'two' ] end it "should accept a compiler" do compiler = subject.compiler scope = subject.scope(:compiler => compiler) scope.compiler.should == compiler end it "should have a source set" do scope = subject.scope scope.source.should_not be_nil scope.source.should_not be_false end end describe ".resource" do it "can have a defined type" do subject.resource(:type => :node).type.should == :node end it "defaults to a type of hostclass" do subject.resource.type.should == :hostclass end it "can have a defined name" do subject.resource(:name => "testingrsrc").name.should == "testingrsrc" end it "defaults to a name of testing" do subject.resource.name.should == "testing" end end describe ".compiler" do let(:node) { subject.node } it "can have a defined node" do subject.compiler(:node => node).node.should be node end end describe ".node" do it "can have a defined name" do subject.node(:name => "mine").name.should == "mine" end it "can have a defined environment" do subject.node(:environment => "mine").environment.name.should == :mine end it "defaults to a name of testinghost" do subject.node.name.should == "testinghost" end it "accepts facts via options for rspec-puppet" do fact_values = { 'fqdn' => "jeff.puppetlabs.com" } node = subject.node(:options => { :parameters => fact_values }) node.parameters.should == fact_values end end describe ".function_method" do it "accepts an injected scope" do Puppet::Parser::Functions.expects(:function).with("my_func").returns(true) scope = mock() scope.expects(:method).with(:function_my_func).returns(:fake_method) subject.function_method("my_func", :scope => scope).should == :fake_method end it "returns nil if the function doesn't exist" do Puppet::Parser::Functions.expects(:function).with("my_func").returns(false) scope = mock() subject.function_method("my_func", :scope => scope).should be_nil end end end puppetlabs_spec_helper-0.10.3/spec/unit/spechelper_spec.rb0000755000004100000410000000241412526336057023772 0ustar www-datawww-data#!/usr/bin/env ruby require 'puppetlabs_spec_helper/puppet_spec_helper' # ensure we can access puppet settings outside of any example group Puppet[:confdir] # set modulepath from which to load custom type Puppet[:modulepath] = File.join(File.dirname(__FILE__), '..', '..') def should_be_able_to_load_types? return true if Puppet::Test::TestHelper.respond_to?(:initialize) case Puppet.version when /^2\.7\.20/ false when /^3\.0\./ false else true end end # construct a top-level describe block whose declared_class is a custom type in this module describe Puppet::Type.type(:spechelper) do it "should load the type from the modulepath" do pending("this is only supported on newer versions of puppet", :unless => should_be_able_to_load_types?) do described_class.should be end end it "should have a doc string" do pending("this is only supported on newer versions of puppet", :unless => should_be_able_to_load_types?) do described_class.doc.should == "This is the spechelper type" end end end describe "Setup of settings" do it "sets confdir and vardir to something not meaningful to force tests to make their choice explicit" do Puppet[:confdir].should == "/dev/null" Puppet[:vardir].should == "/dev/null" end end puppetlabs_spec_helper-0.10.3/lib/0000755000004100000410000000000012526336057017132 5ustar www-datawww-datapuppetlabs_spec_helper-0.10.3/lib/puppetlabs_spec_helper/0000755000004100000410000000000012526336057023662 5ustar www-datawww-datapuppetlabs_spec_helper-0.10.3/lib/puppetlabs_spec_helper/module_spec_helper.rb0000644000004100000410000000343512526336057030052 0ustar www-datawww-datarequire 'rspec-puppet' require 'puppetlabs_spec_helper/puppet_spec_helper' require 'puppetlabs_spec_helper/puppetlabs_spec/puppet_internals' def param_value(subject, type, title, param) subject.resource(type, title).send(:parameters)[param.to_sym] end def verify_contents(subject, title, expected_lines) content = subject.resource('file', title).send(:parameters)[:content] (content.split("\n") & expected_lines).should == expected_lines end spec_path = File.expand_path(File.join(Dir.pwd, 'spec')) fixture_path = File.join(spec_path, 'fixtures') env_module_path = ENV['MODULEPATH'] module_path = File.join(fixture_path, 'modules') module_path = [module_path, env_module_path].join(File::PATH_SEPARATOR) if env_module_path RSpec.configure do |c| c.environmentpath = spec_path if Puppet.version.to_f >= 4.0 c.module_path = module_path c.manifest_dir = File.join(fixture_path, 'manifests') c.parser = 'future' if ENV['FUTURE_PARSER'] == 'yes' ## This depends on rspec-puppet #209 being released #c.strict_variables = true if ENV['STRICT_VARIABLES'] == 'yes' ## These depend on rspec-puppet #212 being released #c.stringify_facts = false if ENV['STRINGIFY_FACTS'] == 'no' #c.trusted_node_data = true if ENV['TRUSTED_NODE_DATA'] == 'yes' #c.ordering = ENV['ORDERING'] if ENV['ORDERING'] c.before :each do Puppet.features.stubs(:root?).returns(true) # stringify_facts and trusted_node_data were removed in puppet4 if Puppet.version.to_f < 4.0 Puppet.settings[:stringify_facts] = false if ENV['STRINGIFY_FACTS'] == 'no' Puppet.settings[:trusted_node_data] = true if ENV['TRUSTED_NODE_DATA'] == 'yes' end Puppet.settings[:strict_variables] = true if ENV['STRICT_VARIABLES'] == 'yes' Puppet.settings[:ordering] = ENV['ORDERING'] if ENV['ORDERING'] end end puppetlabs_spec_helper-0.10.3/lib/puppetlabs_spec_helper/puppetlabs_spec_helper.rb0000644000004100000410000000201512526336057030735 0ustar www-datawww-data# Define the main module namespace for use by the helper modules module PuppetlabsSpec # FIXTURE_DIR represents the standard locations of all fixture data. Normally # this represents /spec/fixtures. This will be used by the fixtures # library to find relative fixture data. FIXTURE_DIR = File.join("spec", "fixtures") unless defined?(FIXTURE_DIR) end # Require all necessary helper libraries so they can be used later require 'puppetlabs_spec_helper/puppetlabs_spec/files' require 'puppetlabs_spec_helper/puppetlabs_spec/fixtures' require 'puppetlabs_spec_helper/puppetlabs_spec/puppet_internals' require 'puppetlabs_spec_helper/puppetlabs_spec/matchers' RSpec.configure do |config| # Include PuppetlabsSpec helpers so they can be called at convenience config.extend PuppetlabsSpec::Files config.extend PuppetlabsSpec::Fixtures config.include PuppetlabsSpec::Fixtures # This will cleanup any files that were created with tmpdir or tmpfile config.after :each do PuppetlabsSpec::Files.cleanup end end puppetlabs_spec_helper-0.10.3/lib/puppetlabs_spec_helper/puppetlabs_spec/0000755000004100000410000000000012526336057027053 5ustar www-datawww-datapuppetlabs_spec_helper-0.10.3/lib/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals.rb0000644000004100000410000000516312526336057033001 0ustar www-datawww-data# Initialize puppet for testing by loading the # 'puppetlabs_spec_helper/puppet_spec_helper' library require 'puppetlabs_spec_helper/puppet_spec_helper' module PuppetlabsSpec module PuppetInternals # parser_scope is intended to return a Puppet::Parser::Scope # instance suitable for placing in a test harness with the intent of # testing parser functions from modules. def scope(parts = {}) if Puppet.version =~ /^2\.[67]/ # loadall should only be necessary prior to 3.x # Please note, loadall needs to happen first when creating a scope, otherwise # you might receive undefined method `function_*' errors Puppet::Parser::Functions.autoloader.loadall end scope_compiler = parts[:compiler] || compiler scope_parent = parts[:parent] || scope_compiler.topscope scope_resource = parts[:resource] || resource(:type => :node, :title => scope_compiler.node.name) if Puppet.version =~ /^2\.[67]/ scope = Puppet::Parser::Scope.new(:compiler => scope_compiler) else scope = Puppet::Parser::Scope.new(scope_compiler) end scope.source = Puppet::Resource::Type.new(:node, "foo") scope.parent = scope_parent scope end module_function :scope def resource(parts = {}) resource_type = parts[:type] || :hostclass resource_name = parts[:name] || "testing" Puppet::Resource::Type.new(resource_type, resource_name) end module_function :resource def compiler(parts = {}) compiler_node = parts[:node] || node() Puppet::Parser::Compiler.new(compiler_node) end module_function :compiler def node(parts = {}) node_name = parts[:name] || 'testinghost' options = parts[:options] || {} if Puppet.version.to_f >= 4.0 node_environment = Puppet::Node::Environment.create(parts[:environment] || 'test', []) else node_environment = Puppet::Node::Environment.new(parts[:environment] || 'test') end options.merge!({:environment => node_environment}) Puppet::Node.new(node_name, options) end module_function :node # Return a method instance for a given function. This is primarily useful # for rspec-puppet def function_method(name, parts = {}) scope = parts[:scope] || scope() # Ensure the method instance is defined by side-effect of checking if it # exists. This is a hack, but at least it's a hidden hack and not an # exposed hack. return nil unless Puppet::Parser::Functions.function(name) scope.method("function_#{name}".intern) end module_function :function_method end end puppetlabs_spec_helper-0.10.3/lib/puppetlabs_spec_helper/puppetlabs_spec/files.rb0000755000004100000410000000240012526336057030501 0ustar www-datawww-datarequire 'fileutils' require 'tempfile' require 'pathname' # A support module for testing files. module PuppetlabsSpec::Files # This code exists only to support tests that run as root, pretty much. # Once they have finally been eliminated this can all go... --daniel 2011-04-08 def self.in_tmp(path) tempdir = Dir.tmpdir Pathname.new(path).ascend do |dir| return true if File.identical?(tempdir, dir) end false end def self.cleanup $global_tempfiles ||= [] while path = $global_tempfiles.pop do fail "Not deleting tmpfile #{path} outside regular tmpdir" unless in_tmp(path) begin FileUtils.rm_r path, :secure => true rescue Errno::ENOENT # nothing to do end end end def make_absolute(path) path = File.expand_path(path) path[0] = 'c' if Puppet.features.microsoft_windows? path end def tmpfilename(name) # Generate a temporary file, just for the name... source = Tempfile.new(name) path = source.path source.close! # ...record it for cleanup, $global_tempfiles ||= [] $global_tempfiles << File.expand_path(path) # ...and bam. path end def tmpdir(name) path = tmpfilename(name) FileUtils.mkdir_p(path) path end end puppetlabs_spec_helper-0.10.3/lib/puppetlabs_spec_helper/puppetlabs_spec/matchers.rb0000644000004100000410000000415212526336057031210 0ustar www-datawww-datarequire 'stringio' require 'rspec/expectations' ######################################################################## # Backward compatibility for Jenkins outdated environment. module RSpec module Matchers module BlockAliases if method_defined? :should alias_method :to, :should unless method_defined? :to end if method_defined? :should_not alias_method :to_not, :should_not unless method_defined? :to_not alias_method :not_to, :should_not unless method_defined? :not_to end end end end ######################################################################## # Custom matchers... RSpec::Matchers.define :have_matching_element do |expected| match do |actual| actual.any? { |item| item =~ expected } end end RSpec::Matchers.define :exit_with do |expected| actual = nil match do |block| begin block.call rescue SystemExit => e actual = e.status end actual and actual == expected end failure_message_for_should do |block| "expected exit with code #{expected} but " + (actual.nil? ? " exit was not called" : "we exited with #{actual} instead") end failure_message_for_should_not do |block| "expected that exit would not be called with #{expected}" end description do "expect exit with #{expected}" end end RSpec::Matchers.define :have_printed do |expected| match do |block| $stderr = $stdout = StringIO.new begin block.call ensure $stdout.rewind @actual = $stdout.read $stdout = STDOUT $stderr = STDERR end if @actual then case expected when String @actual.include? expected when Regexp expected.match @actual else raise ArgumentError, "No idea how to match a #{@actual.class.name}" end end end failure_message_for_should do |actual| if actual.nil? then "expected #{expected.inspect}, but nothing was printed" else "expected #{expected.inspect} to be printed; got:\n#{actual}" end end description do "expect #{expected.inspect} to be printed" end diffable end puppetlabs_spec_helper-0.10.3/lib/puppetlabs_spec_helper/puppetlabs_spec/fixtures.rb0000755000004100000410000000324112526336057031254 0ustar www-datawww-data# This module provides some helper methods to assist with fixtures. It's # methods are designed to help when you have a conforming fixture layout so we # get project consistency. module PuppetlabsSpec::Fixtures # Returns the joined path of the global FIXTURE_DIR plus any path given to it def fixtures(*rest) File.join(PuppetlabsSpec::FIXTURE_DIR, *rest) end # Returns the path to your relative fixture dir. So if your spec test is # /spec/unit/facter/foo_spec.rb then your relative dir will be # /spec/fixture/unit/facter/foo def my_fixture_dir callers = caller while line = callers.shift do next unless found = line.match(%r{/spec/(.*)_spec\.rb:}) return fixtures(found[1]) end fail "sorry, I couldn't work out your path from the caller stack!" end # Given a name, returns the full path of a file from your relative fixture # dir as returned by my_fixture_dir. def my_fixture(name) file = File.join(my_fixture_dir, name) unless File.readable? file then fail "fixture '#{name}' for #{my_fixture_dir} is not readable" end return file end # Return the contents of the file using read when given a name. Uses # my_fixture to work out the relative path. def my_fixture_read(name) File.read(my_fixture(name)) end # Provides a block mechanism for iterating across the files in your fixture # area. def my_fixtures(glob = '*', flags = 0) files = Dir.glob(File.join(my_fixture_dir, glob), flags) unless files.length > 0 then fail "fixture '#{glob}' for #{my_fixture_dir} had no files!" end block_given? and files.each do |file| yield file end files end end puppetlabs_spec_helper-0.10.3/lib/puppetlabs_spec_helper/rake_tasks.rb0000644000004100000410000001574112526336057026346 0ustar www-datawww-datarequire 'rake' require 'rspec/core/rake_task' require 'yaml' task :default => [:help] desc "Run spec tests on an existing fixtures directory" RSpec::Core::RakeTask.new(:spec_standalone) do |t| t.rspec_opts = ['--color'] t.pattern = 'spec/{classes,defines,unit,functions,hosts,integration}/**/*_spec.rb' end desc "Run beaker acceptance tests" RSpec::Core::RakeTask.new(:beaker) do |t| t.rspec_opts = ['--color'] t.pattern = 'spec/acceptance' end desc "Generate code coverage information" RSpec::Core::RakeTask.new(:coverage) do |t| t.rcov = true t.rcov_opts = ['--exclude', 'spec'] end # This is a helper for the self-symlink entry of fixtures.yml def source_dir Dir.pwd end def fixtures(category) begin fixtures = YAML.load_file(".fixtures.yml")["fixtures"] rescue Errno::ENOENT return {} end if not fixtures abort("malformed fixtures.yml") end result = {} if fixtures.include? category and fixtures[category] != nil fixtures[category].each do |fixture, opts| if opts.instance_of?(String) source = opts target = "spec/fixtures/modules/#{fixture}" real_source = eval('"'+source+'"') result[real_source] = target elsif opts.instance_of?(Hash) target = "spec/fixtures/modules/#{fixture}" real_source = eval('"'+opts["repo"]+'"') result[real_source] = { "target" => target, "ref" => opts["ref"], "branch" => opts["branch"], "scm" => opts["scm"] } end end end return result end def clone_repo(scm, remote, target, ref=nil, branch=nil) args = [] case scm when 'hg' args.push('clone') args.push('-u', ref) if ref args.push(remote, target) when 'git' args.push('clone') args.push('--depth 1') unless ref args.push('-b', branch) if branch args.push(remote, target) else fail "Unfortunately #{scm} is not supported yet" end system("#{scm} #{args.flatten.join ' '}") end def revision(scm, target, ref) args = [] case scm when 'hg' args.push('update', 'clean', '-r', ref) when 'git' args.push('reset', '--hard', ref) else fail "Unfortunately #{scm} is not supported yet" end system("cd #{target} && #{scm} #{args.flatten.join ' '}") end desc "Create the fixtures directory" task :spec_prep do # Ruby only sets File::ALT_SEPARATOR on Windows and Rubys standard library # uses this to check for Windows is_windows = !!File::ALT_SEPARATOR puppet_symlink_available = false begin require 'puppet' puppet_symlink_available = Puppet::FileSystem.respond_to?(:symlink) rescue end fixtures("repositories").each do |remote, opts| scm = 'git' if opts.instance_of?(String) target = opts elsif opts.instance_of?(Hash) target = opts["target"] ref = opts["ref"] scm = opts["scm"] if opts["scm"] branch = opts["branch"] if opts["branch"] end unless File::exists?(target) || clone_repo(scm, remote, target, ref, branch) fail "Failed to clone #{scm} repository #{remote} into #{target}" end revision(scm, target, ref) if ref end FileUtils::mkdir_p("spec/fixtures/modules") fixtures("symlinks").each do |source, target| if is_windows fail "Cannot symlink on Windows unless using at least Puppet 3.5" if !puppet_symlink_available Puppet::FileSystem::exist?(target) || Puppet::FileSystem::symlink(source, target) else File::exists?(target) || FileUtils::ln_sf(source, target) end end fixtures("forge_modules").each do |remote, opts| if opts.instance_of?(String) target = opts ref = "" elsif opts.instance_of?(Hash) target = opts["target"] ref = "--version #{opts['ref']}" end next if File::exists?(target) unless system("puppet module install " + ref + \ " --ignore-dependencies" \ " --force" \ " --target-dir spec/fixtures/modules #{remote}") fail "Failed to install module #{remote} to #{target}" end end FileUtils::mkdir_p("spec/fixtures/manifests") FileUtils::touch("spec/fixtures/manifests/site.pp") end desc "Clean up the fixtures directory" task :spec_clean do fixtures("repositories").each do |remote, opts| if opts.instance_of?(String) target = opts elsif opts.instance_of?(Hash) target = opts["target"] end FileUtils::rm_rf(target) end fixtures("forge_modules").each do |remote, opts| if opts.instance_of?(String) target = opts elsif opts.instance_of?(Hash) target = opts["target"] end FileUtils::rm_rf(target) end fixtures("symlinks").each do |source, target| FileUtils::rm_f(target) end if File.zero?("spec/fixtures/manifests/site.pp") FileUtils::rm_f("spec/fixtures/manifests/site.pp") end end desc "Run spec tests in a clean fixtures directory" task :spec do Rake::Task[:spec_prep].invoke Rake::Task[:spec_standalone].invoke Rake::Task[:spec_clean].invoke end desc "List available beaker nodesets" task :beaker_nodes do Dir['spec/acceptance/nodesets/*.yml'].sort!.select { |node| node.slice!('.yml') puts File.basename(node) } end desc "Build puppet module package" task :build do # This will be deprecated once puppet-module is a face. begin Gem::Specification.find_by_name('puppet-module') rescue Gem::LoadError, NoMethodError require 'puppet/face' pmod = Puppet::Face['module', :current] pmod.build('./') end end desc "Clean a built module package" task :clean do FileUtils.rm_rf("pkg/") end require 'puppet-lint/tasks/puppet-lint' # Must clear as it will not override the existing puppet-lint rake task since we require to import for # the PuppetLint::RakeTask Rake::Task[:lint].clear # Relative is not able to be set within the context of PuppetLint::RakeTask PuppetLint.configuration.relative = true PuppetLint::RakeTask.new(:lint) do |config| config.fail_on_warnings = true config.disable_checks = [ '80chars', 'class_inherits_from_params_class', 'class_parameter_defaults', 'documentation', 'single_quote_string_with_variables'] config.ignore_paths = ["tests/**/*.pp", "vendor/**/*.pp","examples/**/*.pp" "spec/**/*.pp", "pkg/**/*.pp"] end require 'puppet-syntax/tasks/puppet-syntax' PuppetSyntax.exclude_paths ||= [] PuppetSyntax.exclude_paths << "spec/fixtures/**/*" PuppetSyntax.exclude_paths << "pkg/**/*" PuppetSyntax.exclude_paths << "vendor/**/*" PuppetSyntax.future_parser = true if ENV['FUTURE_PARSER'] == 'yes' desc "Check syntax of Ruby files and call :syntax and :metadata" task :validate do Dir['lib/**/*.rb'].each do |lib_file| sh "ruby -c #{lib_file}" end Rake::Task[:syntax].invoke Rake::Task[:metadata].invoke if File.exist?('metadata.json') end desc "Validate metadata.json file" task :metadata do begin require 'metadata_json_lint' sh "metadata-json-lint metadata.json" rescue LoadError => e warn "Skipping metadata validation; the metadata-json-lint gem was not found" end end desc "Display the list of available rake tasks" task :help do system("rake -T") end puppetlabs_spec_helper-0.10.3/lib/puppetlabs_spec_helper/version.rb0000644000004100000410000000011512526336057025671 0ustar www-datawww-datamodule PuppetlabsSpecHelper module Version STRING = '0.10.3' end end puppetlabs_spec_helper-0.10.3/lib/puppetlabs_spec_helper/puppet_spec_helper.rb0000644000004100000410000001506312526336057030102 0ustar www-datawww-datarequire 'puppetlabs_spec_helper/puppetlabs_spec_helper' # Don't want puppet getting the command line arguments for rake or autotest ARGV.clear # This is needed because we're using mocha with rspec instead of Test::Unit or MiniTest ENV['MOCHA_OPTIONS']='skip_integration' require 'puppet' require 'rspec/expectations' require 'mocha/api' require 'pathname' require 'tmpdir' require 'puppetlabs_spec_helper/puppetlabs_spec/files' ###################################################################################### # WARNING # ###################################################################################### # # You should probably be frightened by this file. :) # # The goal of this file is to try to maximize spec-testing compatibility between # multiple versions of various external projects (which depend on puppet core) and # multiple versions of puppet core itself. This is accomplished via a series # of hacks and magical incantations that I am not particularly proud of. However, # after discussion it was decided that the goal of achieving compatibility was # a very worthy one, and that isolating the hacks to one place in a non-production # project was as good a solution as we could hope for. # # You may want to hold your nose before you proceed. :) # # This is just a utility class to allow us to isolate the various version-specific # branches of initialization logic into methods without polluting the global namespace.# module Puppet class PuppetSpecInitializer # This method uses the "new"/preferred approach of delegating all of the test # state initialization to puppet itself, via Puppet::Test::TestHelper API. This # should be fairly future-proof as long as that API doesn't change, which it # hopefully will not need to. def self.initialize_via_testhelper(config) begin Puppet::Test::TestHelper.initialize rescue NoMethodError Puppet::Test::TestHelper.before_each_test end # connect rspec hooks to TestHelper methods. config.before :all do Puppet::Test::TestHelper.before_all_tests end config.after :all do Puppet::Test::TestHelper.after_all_tests end config.before :each do Puppet::Test::TestHelper.before_each_test end config.after :each do Puppet::Test::TestHelper.after_each_test end end # This method is for initializing puppet state for testing for older versions # of puppet that do not support the new TestHelper API. As you can see, # this involves explicitly modifying global variables, directly manipulating # Puppet's Settings singleton object, and other fun implementation details # that code external to puppet should really never know about. def self.initialize_via_fallback_compatibility(config) config.before :all do # nothing to do for now end config.after :all do # nothing to do for now end config.before :each do # these globals are set by Application $puppet_application_mode = nil $puppet_application_name = nil # REVISIT: I think this conceals other bad tests, but I don't have time to # fully diagnose those right now. When you read this, please come tell me # I suck for letting this float. --daniel 2011-04-21 Signal.stubs(:trap) # Set the confdir and vardir to gibberish so that tests # have to be correctly mocked. Puppet[:confdir] = "/dev/null" Puppet[:vardir] = "/dev/null" # Avoid opening ports to the outside world Puppet.settings[:bindaddress] = "127.0.0.1" end config.after :each do Puppet.settings.clear Puppet::Node::Environment.clear Puppet::Util::Storage.clear Puppet::Util::ExecutionStub.reset if Puppet::Util.constants.include? "ExecutionStub" PuppetlabsSpec::Files.cleanup end end end end # Here we attempt to load the new TestHelper API, and print a warning if we are falling back # to compatibility mode for older versions of puppet. begin require 'puppet/test/test_helper' rescue LoadError => err $stderr.puts("Warning: you appear to be using an older version of puppet; spec_helper will use fallback compatibility mode.") end # JJM Hack to make the stdlib tests run in Puppet 2.6 (See puppet commit cf183534) if not Puppet.constants.include? "Test" then module Puppet::Test class LogCollector def initialize(logs) @logs = logs end def <<(value) @logs << value end end end Puppet::Util::Log.newdesttype :log_collector do match "Puppet::Test::LogCollector" def initialize(messages) @messages = messages end def handle(msg) @messages << msg end end end # And here is where we do the main rspec configuration / setup. RSpec.configure do |config| config.mock_with :mocha # determine whether we can use the new API or not, and call the appropriate initializer method. if (defined?(Puppet::Test::TestHelper)) Puppet::PuppetSpecInitializer.initialize_via_testhelper(config) else Puppet::PuppetSpecInitializer.initialize_via_fallback_compatibility(config) end # Here we do some general setup that is relevant to all initialization modes, regardless # of the availability of the TestHelper API. config.before :each do # Here we redirect logging away from console, because otherwise the test output will be # obscured by all of the log output. # # TODO: in a more sane world, we'd move this logging redirection into our TestHelper # class, so that it was not coupled with a specific testing framework (rspec in this # case). Further, it would be nicer and more portable to encapsulate the log messages # into an object somewhere, rather than slapping them on an instance variable of the # actual test class--which is what we are effectively doing here. # # However, because there are over 1300 tests that are written to expect # this instance variable to be available--we can't easily solve this problem right now. @logs = [] Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(@logs)) @log_level = Puppet::Util::Log.level end config.after :each do # clean up after the logging changes that we made before each test. # TODO: this should be abstracted in the future--see comments above the '@logs' block in the # "before" code above. @logs.clear Puppet::Util::Log.close_all Puppet::Util::Log.level = @log_level end end puppetlabs_spec_helper-0.10.3/README.markdown0000644000004100000410000002111612526336057021066 0ustar www-datawww-dataPuppet Labs Spec Helper ======================= The Short Version ----------------- This repository is meant to provide a single source of truth for how to initialize different Puppet versions for spec testing. The common use case is a module such as [stdlib](http://forge.puppetlabs.com/puppetlabs/stdlib) that works with many versions of Puppet. The stdlib module should require the spec helper in this repository, which will in turn automatically figure out the version of Puppet being tested against and perform version specific initialization. Other "customers" that should use this module are: * [Facter](https://github.com/puppetlabs/facter) * [PuppetDB](https://github.com/puppetlabs/puppetdb) * [Mount Providers](https://github.com/puppetlabs/puppetlabs-mount_providers) Usage ===== When developing or testing modules, simply clone this repository and install the gem it contains. $ git clone git://github.com/puppetlabs/puppetlabs_spec_helper.git $ cd puppetlabs_spec_helper $ rake package:gem $ gem install pkg/puppetlabs_spec_helper-*.gem Add this to your project's spec\_helper.rb: require 'puppetlabs_spec_helper/module_spec_helper' Add this to your project's Rakefile: require 'puppetlabs_spec_helper/rake_tasks' And run the spec tests: $ cd $modulename $ rake spec Issues ====== Please file issues against this project at the [Puppet Labs Issue Tracker](https://tickets.puppetlabs.com/browse/MODULES) The Long Version ---------------- Purpose of this Project ======================= This project is intended to serve two purposes: 1. To serve as a bridge between external projects and multiple versions of puppet; in other words, if your project has a dependency on puppet, you shouldn't need to need to worry about the details of how to initialize puppet's state for testing, no matter what version of puppet you are testing against. 2. To provide some convenience classes / methods for doing things like creating tempfiles, common rspec matchers, etc. These classes are in the puppetlabs\_spec directory. 3. To provide a common set of Rake tasks so that the procedure for testing modules is unified. To Use this Project =================== The most common usage scenario is that you will check out the 'master' branch of this project from github, and install it as a rubygem. There should be few or no cases where you would want to have any other branch of this project besides master/HEAD. Initializing Puppet for Testing =============================== In most cases, your project should be able to define a spec\_helper.rb that includes just this one simple line: require 'puppetlabs_spec_helper/puppet_spec_helper' Then, as long as the gem is installed, you should be all set. If you are using rspec-puppet for module testing, you will want to include a different library: require 'puppetlabs_spec_helper/module_spec_helper' NOTE that this is specifically for initializing Puppet's core. If your project does not have any dependencies on puppet and you just want to use the utility classes, see the next section. A number of the Puppet parser features, controlled via configuration during a normal puppet run, can be controlled by exporting specific environment variables for the spec run. These are: * ``FUTURE_PARSER`` - set to "yes" to enable the [future parser](http://docs.puppetlabs.com/puppet/latest/reference/experiments_future.html), the equivalent of setting [parser=future](http://docs.puppetlabs.com/references/latest/configuration.html#parser) in puppet.conf. * ``STRICT_VARIABLES`` - set to "yes" to enable strict variable checking, the equivalent of setting [strict_variables](http://docs.puppetlabs.com/references/latest/configuration.html#strictvariables)=true in puppet.conf. * ``ORDERING`` - set to the desired ordering method ("title-hash", "manifest", or "random") to set the order of unrelated resources when applying a catalog. Leave unset for the default behavior, currently "random". This is equivalent to setting [ordering](http://docs.puppetlabs.com/references/latest/configuration.html#ordering) in puppet.conf. * ``STRINGIFY_FACTS`` - set to "no" to enable [structured facts](http://docs.puppetlabs.com/facter/2.0/fact_overview.html#writing-structured-facts), otherwise leave unset to retain the current default behavior. This is equivalent to setting [stringify_facts=false](http://docs.puppetlabs.com/references/latest/configuration.html#stringifyfacts) in puppet.conf. * ``TRUSTED_NODE_DATA`` - set to "yes" to enable [the $facts hash and trusted node data](http://docs.puppetlabs.com/puppet/latest/reference/lang_facts_and_builtin_vars.html), which enabled ``$facts`` and ``$trusted`` hashes. This is equivalent to setting [trusted_node_data=true](http://docs.puppetlabs.com/references/latest/configuration.html#trustednodedata) in puppet.conf. As an example, to run spec tests with the future parser, strict variable checking, and manifest ordering, you would: FUTURE_PARSER=yes STRICT_VARIABLES=yes ORDERING=manifest rake spec Using Utility Classes ===================== If you'd like to use the Utility classes (PuppetlabsSpec::Files, PuppetlabsSpec::Fixtures), you just need to add this to your project's spec\_helper.rb: require 'puppetlabs_spec_helper/puppetlabs_spec_helper' NOTE that the above line happens automatically if you've required 'puppetlabs\_spec\_helper/puppet\_spec\_helper', so you don't need to do both. In either case, you'll have all of the functionality of Puppetlabs::Files, Puppetlabs::Fixtures, etc., mixed-in to your rspec context. Using Fixtures ============== `puppetlabs_spec_helper` has the ability to populate the `spec/fixtures/modules` directory with dependent modules when `rake spec` or `rake spec_prep` is run. To do so, all required modules should be listed in a file named `.fixtures.yml` in the root of the project. When specifying the repo source of the fixture you have a few options as to which revision of the codebase you wish to use. * repo - the url to the repo * scm - options include git or hg. This is an optional step as the helper code will figure out which scm is used. ```yaml scm: git scm: hg ``` * target - the directory name to clone the repo into ie. `target: mymodule` defaults to the repo name (Optional) * ref - used to specify the tag name like version hash of commit (Optional) ```yaml ref: 1.0.0 ref: 880fca52c ``` * branch - used to specify the branch name you want to use ie. `branch: development` **Note:** ref and branch can be used together to get a specific revision on a specific branch Fixtures Examples ----------------- Basic fixtures that will symlink `spec/fixtures/modules/my_modules` to the project root: fixtures: symlinks: my_module: "#{source_dir}" Add `firewall` and `stdlib` as required module fixtures: fixtures: repositories: firewall: "git://github.com/puppetlabs/puppetlabs-firewall" stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib" symlinks: my_module: "#{source_dir}" Specify that the git tag `2.4.2` of `stdlib' should be checked out: fixtures: repositories: firewall: "git://github.com/puppetlabs/puppetlabs-firewall" stdlib: repo: "git://github.com/puppetlabs/puppetlabs-stdlib" ref: "2.6.0" symlinks: my_module: "#{source_dir}" Install modules from Puppet Forge: fixtures: forge_modules: firewall: "puppetlabs/firewall" stdlib: repo: "puppetlabs/stdlib" ref: "2.6.0" Testing Parser Functions ======================== This library provides a consistent way to create a Puppet::Parser::Scope object suitable for use in a testing harness with the intent of testing the expected behavior of parser functions distributed in modules. Previously, modules would do something like this: describe "split()" do let(:scope) { Puppet::Parser::Scope.new } it "should split 'one;two' on ';' into [ 'one', 'two' ]" do scope.function_split(['one;two', ';']).should == [ 'one', 'two' ] end end This will not work beyond Puppet 2.7 as we have changed the behavior of the scope initializer in Puppet 3.0. Modules should instead initialize scope instances in a manner decoupled from the internal behavior of Puppet: require 'puppetlabs_spec_helper/puppetlabs_spec/puppet_internals' describe "split()" do let(:scope) { PuppetlabsSpec::PuppetInternals.scope } it "should split 'one;two' on ';' into [ 'one', 'two' ]" do scope.function_split(['one;two', ';']).should == [ 'one', 'two' ] end end EOF puppetlabs_spec_helper-0.10.3/metadata.yml0000644000004100000410000000740112526336057020671 0ustar www-datawww-data--- !ruby/object:Gem::Specification name: puppetlabs_spec_helper version: !ruby/object:Gem::Version version: 0.10.3 platform: ruby authors: - Puppet Labs autorequire: bindir: bin cert_chain: [] date: 2015-05-11 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: rspec-puppet requirement: !ruby/object:Gem::Requirement requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: puppet-lint requirement: !ruby/object:Gem::Requirement requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: puppet-syntax requirement: !ruby/object:Gem::Requirement requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: mocha requirement: !ruby/object:Gem::Requirement requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' description: Contains rake tasks and a standard spec_helper for running spec tests on puppet modules email: - modules-dept@puppetlabs.com executables: [] extensions: [] extra_rdoc_files: [] files: - .gitignore - .noexec.yaml - CHANGELOG.md - Gemfile - LICENSE - README.markdown - Rakefile - lib/puppetlabs_spec_helper/module_spec_helper.rb - lib/puppetlabs_spec_helper/puppet_spec_helper.rb - lib/puppetlabs_spec_helper/puppetlabs_spec/files.rb - lib/puppetlabs_spec_helper/puppetlabs_spec/fixtures.rb - lib/puppetlabs_spec_helper/puppetlabs_spec/matchers.rb - lib/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals.rb - lib/puppetlabs_spec_helper/puppetlabs_spec_helper.rb - lib/puppetlabs_spec_helper/rake_tasks.rb - lib/puppetlabs_spec_helper/version.rb - puppet_spec_helper.rb - puppetlabs_spec_helper.gemspec - puppetlabs_spec_helper.rb - spec/lib/puppet/type/spechelper.rb - spec/unit/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals_spec.rb - spec/unit/spechelper_spec.rb - spec/watchr.rb homepage: http://github.com/puppetlabs/puppetlabs_spec_helper licenses: - Apache-2.0 metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.4.5 signing_key: specification_version: 4 summary: Standard tasks and configuration for module spec tests test_files: - spec/lib/puppet/type/spechelper.rb - spec/unit/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals_spec.rb - spec/unit/spechelper_spec.rb - spec/watchr.rb has_rdoc: puppetlabs_spec_helper-0.10.3/.gitignore0000644000004100000410000000003112526336057020346 0ustar www-datawww-dataGemfile.lock pkg/ .*.sw* puppetlabs_spec_helper-0.10.3/puppet_spec_helper.rb0000644000004100000410000000042212526336057022575 0ustar www-datawww-data$:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'lib')) require 'puppetlabs_spec_helper/puppet_spec_helper' puts "Using 'PROJECT_ROOT/puppet_spec_helper' is deprecated, please install as a gem and require 'puppetlabs_spec_helper/puppet_spec_helper' instead" puppetlabs_spec_helper-0.10.3/LICENSE0000644000004100000410000000114612526336057017373 0ustar www-datawww-dataCopyright (C) 2012 Puppet Labs Inc Puppet Labs can be contacted at: info@puppetlabs.com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.puppetlabs_spec_helper-0.10.3/CHANGELOG.md0000644000004100000410000001622312526336057020201 0ustar www-datawww-data# Change log All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). ## [0.10.3] - 2015-05-11 ### Summary: A bugfix for puppet 3 and puppet 4 tests being able to run with the same environment variables. ### Fixed: - Allow `STRINGIFY_FACTS` and `TRUSTED_NODE_DATA` to be set on Puppet 4 as noop instead of fail - Fix linting to be more like approved module criteria ## [0.10.2] - 2015-04-14 ### Summary: A bugfix for puppet 4 coming out, which manages modulepath and environments differently. ### Fixed: - Use puppet 4 environmentpath and environment creation on puppet 4 ## [0.10.1] - 2015-03-17 ### Summary: A bugfix for the previous release when using references. ### Fixed: - Only shallow clone if not using a reference ## [0.10.0] - 2015-03-16 ### Summary: This release adds shallow fixtures clones to speed up the spec_prep step for rspec-puppet ### Added: - Shallow clone fixtures ### Fixed: - Don't lint in vendor/ (spec/fixtures/ and pkg/ are alread ignored) - Don't syntax check in spec/fixtures/, pkg/, or vendor/ ## [0.9.1] - 2015-02-24 ### Summary: This release removes the hard dependency on metadata-json-lint, as it requires a dev toolchain to install the 'json' gem. ### Fixed: - Only warn when metadata-json-lint isn't installed instead of requiring it ## [0.9.0] - 2015-02-24 ### Summary: This release adds fixes for rspec-puppet 2.0 and json linting for metadata.json ### Added: - Add json linting for metadata.json (adds dep on metadata-json-lint gem) - Document using references in fixtures ### Fixed: - `FUTURE_PARSER=yes` working with rspec-puppet 2.0 - Symlinks breaking on windows - rspec as a runtime dependency conflicting with rspec-puppet - root stub for testing execs ## [0.8.2] - 2014-10-01 ### Summary: This release fixes the lint task on the latest puppet-lint ### Fixed: - Fix the lint task require code ## [0.8.1] - 2014-08-25 ### Summary: This release corrects compatibility with the recently-released puppet-lint 1.0.0 ### Fixed: - Turn on relative autoloader lint checking for backwards-compatibility - Turn off param class inheritance check (deprecated style) - Fix ignore paths to ignore `pkg/*` ## [0.8.0] - 2014-07-29 ### Summary: This release uses the new puppet-syntax gem to perform manifest validation better than before! Shiny. ### Added: - Use puppet-syntax gem for manifest validation rake task ### Fixed: - Fix compatibility with rspec 3 ## [0.7.0] - 2014-07-17 ### Summary: This feature release adds the ability to test structured facts, manifest ordering, and trusted node facts, and check out branches with fixtures. ### Added: - Add `STRINGIFY_FACTS=no` for structured facts - Add `TRUSTED_NODE_DATA=yes` for trusted node data - Add `ORDERING=` for manifest ordering - Add `:branch` support for fixtures on a branch. ### Fixed: - Fix puppet-lint to ignore spec/fixtures/ ## [0.6.0] - 2014-07-02 ### Summary: This feature release adds the `validate` rake task and the ability to test strict variables and the future parser with rspec-puppet. ### Added: - Add `validate` rake task. - Add `STRICT_VARIABLES=yes` to module_spec_helper - Add `FUTURE_PARSER=yes` to module_spec_helper ### Fixed: - Avoid conflict with Object.clone - Install forge fixtures without conflicting with already-installed modules ## [0.5.2] - 2014-06-19 ### Summary: This release removes the previously non-existant puppet runtime dependency to better match rspec-puppet and puppet-lint and allow system puppet packages to be used instead of gems. ### Fixed: - Remove puppet dependency from gemspec ## [0.5.1] - 2014-06-09 ### Summary: This release re-adds mocha mocking, which was mistakenly removed in 0.5.0 ### Fixed: - Re-enable mocha mocking as default. ## [0.5.0] - 2014-06-06 ### Summary: This is the first feature release in over a year. The biggest feature is fixtures supporting the forge, and not just github, plus rake tasks for syntax checking and beaker. ### Added: - Install modules from the forge, not just git - Beaker rake tasks added - Syntax task added - Rake spec runs tests in `integration/` directory ### Fixed: - Fix the gemspec so that this may be used with bundler - Fix removal of symlinks - Fix removal of site.pp only when empty - Ignore fixtures for linting - Remove extra mocha dependency - Remove rspec pinning (oops) ## 0.4.2 - 2014-06-06 [YANKED] ### Summary: This release corrects the pinning of rspec for modules which are not rspec 3 compatible yet. ### Fixed: * Pin to 2.x range for rspec 2 * Fix aborting rake task when packaging gem * Fix puppet issue tracker url * Fix issue with running `git reset` in the incorrect dir ## [0.4.1] - 2013-02-08 ### Fixed * (#18165) Mark tests pending on broken puppet versions * (#18165) Initialize TestHelper as soon as possible * Maint: Change formatting and handle windows path separator ## [0.4.0] - 2012-12-14 ### Added * Add readme for fixtures * add opts logic to rake spec_clean * add backwards-compatible support for arbitrary git refs in .fixtures.yml ### Fixed * Rake should fail if git can't clone repository * Fix Mocha deprecations * Only remove the site.pp if it is empty * (#15464) Make contributing easy via bundle Gemfile * (#15464) Add gemspec from 0.3.0 published gem ## [0.3.0] - 2012-08-14 ### Added * Add PuppetInternals compatibility module for scope, node, compiler, and functions * Add rspec-puppet convention directories to rake tasks ## [0.2.0] - 2012-07-05 ### Fixed * Fix integration with mocha-0.12.0 * Fix coverage rake task * Fix an issue creating the fixtures directory ## 0.1.0 - 2012-06-08 ### Added * Initial release [unreleased]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.10.1...master [0.10.2]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.10.1...0.10.2 [0.10.1]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.10.0...0.10.1 [0.10.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.9.1...0.10.0 [0.9.1]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.9.0...0.9.1 [0.9.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.8.2...0.9.0 [0.8.2]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.8.1...0.8.2 [0.8.1]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.8.0...0.8.1 [0.8.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.7.0...0.8.0 [0.7.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.6.0...0.7.0 [0.6.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.5.2...0.6.0 [0.5.2]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.5.1...0.5.2 [0.5.1]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.5.0...0.5.1 [0.5.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.4.1...0.5.0 [0.4.1]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.4.0...0.4.1 [0.4.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.3.0...0.4.0 [0.3.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.2.0...0.3.0 [0.2.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.1.0...0.2.0 [0.1.0]: https://github.com/puppetlabs/puppetlabs_spec_helper/compare/0.0.0...0.1.0 puppetlabs_spec_helper-0.10.3/.noexec.yaml0000644000004100000410000000003712526336057020607 0ustar www-datawww-data--- exclude: - rake - rspec puppetlabs_spec_helper-0.10.3/puppetlabs_spec_helper.gemspec0000644000004100000410000000211512526336057024460 0ustar www-datawww-data# -*- encoding: utf-8 -*- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__) require "puppetlabs_spec_helper/version" Gem::Specification.new do |s| s.name = "puppetlabs_spec_helper" s.version = PuppetlabsSpecHelper::Version::STRING s.authors = ["Puppet Labs"] s.email = ["modules-dept@puppetlabs.com"] s.homepage = "http://github.com/puppetlabs/puppetlabs_spec_helper" s.summary = "Standard tasks and configuration for module spec tests" s.description = "Contains rake tasks and a standard spec_helper for running spec tests on puppet modules" s.licenses = 'Apache-2.0' s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } # Runtime dependencies, but also probably dependencies of requiring projects s.add_runtime_dependency 'rake' s.add_runtime_dependency 'rspec-puppet' s.add_runtime_dependency 'puppet-lint' s.add_runtime_dependency 'puppet-syntax' s.add_runtime_dependency 'mocha' end