Revision 4018e336
Added by Stephen Benjamin about 8 years ago
Gemfile | ||
---|---|---|
|
||
gem 'puppet', ENV.key?('PUPPET_VERSION') ? "~> #{ENV['PUPPET_VERSION']}" : '~> 3.5'
|
||
|
||
gem 'rake'
|
||
gem 'rspec-puppet', '~> 2.0'
|
||
if RUBY_VERSION.start_with? '1.8'
|
||
gem 'rake', '< 11'
|
||
gem 'rspec', '>= 3', '< 3.2'
|
||
gem 'rspec-puppet-facts', '< 1.4.0'
|
||
else
|
||
gem 'rake'
|
||
gem 'rspec', '~> 3.0'
|
||
gem 'rspec-puppet-facts'
|
||
end
|
||
gem 'rspec-puppet', '~> 2.3'
|
||
gem 'puppetlabs_spec_helper', '>= 0.8.0'
|
||
gem 'puppet-lint', '>= 1'
|
||
gem 'puppet-lint-unquoted_string-check'
|
||
... | ... | |
gem 'puppet-lint-leading_zero-check'
|
||
gem 'puppet-lint-trailing_comma-check'
|
||
gem 'puppet-lint-file_ensure-check'
|
||
gem 'puppet-lint-param-docs', '>= 1.3.0'
|
||
gem 'simplecov'
|
||
gem 'puppet-blacksmith', '>= 3.1.0', {"groups"=>["development"]}
|
||
gem 'rest-client', '< 1.7', {"platforms"=>["ruby_18"], "groups"=>["development"]}
|
||
gem 'mime-types', '~> 1.0', {"platforms"=>["ruby_18"], "groups"=>["development"]}
|
||
gem 'rspec-puppet-facts'
|
||
gem 'metadata-json-lint'
|
||
gem 'rspec', '< 3.2.0', {"platforms"=>["ruby_18"]}
|
||
|
||
# vim:ft=ruby
|
Rakefile | ||
---|---|---|
require 'puppetlabs_spec_helper/rake_tasks'
|
||
require 'puppet-lint/tasks/puppet-lint'
|
||
|
||
# blacksmith isn't always present, e.g. on Travis with --without development
|
||
begin
|
||
require 'puppet_blacksmith/rake_tasks'
|
||
Blacksmith::RakeTask.new do |t|
|
||
t.tag_pattern = "%s"
|
||
# blacksmith is broken with ruby 1.8.7
|
||
if Gem::Version.new(RUBY_VERSION) > Gem::Version.new('1.8.7')
|
||
# blacksmith isn't always present, e.g. on Travis with --without development
|
||
begin
|
||
require 'puppet_blacksmith/rake_tasks'
|
||
Blacksmith::RakeTask.new do |t|
|
||
t.tag_pattern = "%s"
|
||
end
|
||
rescue LoadError
|
||
end
|
||
rescue LoadError
|
||
end
|
||
|
||
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp", "vendor/**/*.pp"]
|
||
PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}'
|
||
|
||
require 'puppet-lint-param-docs/tasks'
|
||
PuppetLintParamDocs.define_selective do |config|
|
||
config.pattern = []
|
||
end
|
||
|
||
task :default => [:validate, :lint, :spec]
|
spec/spec_helper.rb | ||
---|---|---|
class Undef
|
||
def inspect; 'undef'; end
|
||
end
|
||
|
||
# Running tests with the ONLY_OS environment variable set
|
||
# limits the tested platforms to the specified values.
|
||
# Example: ONLY_OS=centos-7-x86_64,ubuntu-14-x86_64
|
||
def only_test_os
|
||
if ENV.key?('ONLY_OS')
|
||
ENV['ONLY_OS'].split(',')
|
||
end
|
||
end
|
||
|
||
# Running tests with the EXCLUDE_OS environment variable set
|
||
# limits the tested platforms to all but the specified values.
|
||
# Example: EXCLUDE_OS=centos-7-x86_64,ubuntu-14-x86_64
|
||
def exclude_test_os
|
||
if ENV.key?('EXCLUDE_OS')
|
||
ENV['EXCLUDE_OS'].split(',')
|
||
end
|
||
end
|
||
|
||
def get_content(subject, title)
|
||
content = subject.resource('file', title).send(:parameters)[:content]
|
||
content.split(/\n/).reject { |line| line =~ /(^#|^$|^\s+#)/ }
|
||
end
|
||
|
||
def verify_exact_contents(subject, title, expected_lines)
|
||
expect(get_content(subject, title)).to eq(expected_lines)
|
||
end
|
||
|
||
def verify_concat_fragment_contents(subject, title, expected_lines)
|
||
content = subject.resource('concat::fragment', title).send(:parameters)[:content]
|
||
expect(content.split("\n") & expected_lines).to eq(expected_lines)
|
||
end
|
||
|
||
def verify_concat_fragment_exact_contents(subject, title, expected_lines)
|
||
content = subject.resource('concat::fragment', title).send(:parameters)[:content]
|
||
expect(content.split(/\n/).reject { |line| line =~ /(^#|^$|^\s+#)/ }).to eq(expected_lines)
|
||
end
|
Also available in: Unified diff
Modulesync