-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated function, Added Tests, Updated Docs
- Loading branch information
ipcrm
committed
Jan 22, 2016
1 parent
c95d917
commit 265d7ed
Showing
8 changed files
with
237 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--format documentation | ||
--color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
source "https://rubygems.org" | ||
|
||
group :test do | ||
gem "rake" | ||
gem "puppet", ENV['PUPPET_GEM_VERSION'] || '~> 4.3.1' | ||
# gem "rspec", '< 3.2.0' | ||
gem "rspec" | ||
gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git' | ||
gem "puppetlabs_spec_helper" | ||
gem "metadata-json-lint" | ||
gem "rspec-puppet-facts" | ||
gem 'rubocop', '0.33.0' | ||
gem 'simplecov', '>= 0.11.0' | ||
gem 'simplecov-console' | ||
|
||
gem "puppet-lint-absolute_classname-check" | ||
gem "puppet-lint-leading_zero-check" | ||
gem "puppet-lint-trailing_comma-check" | ||
gem "puppet-lint-version_comparison-check" | ||
gem "puppet-lint-classes_and_types_beginning_with_digits-check" | ||
gem "puppet-lint-unquoted_string-check" | ||
end | ||
|
||
group :development do | ||
gem "travis" | ||
gem "travis-lint" | ||
gem "puppet-blacksmith" | ||
gem "guard-rake" | ||
end | ||
|
||
group :system_tests do | ||
gem "beaker" | ||
gem "beaker-rspec" | ||
gem "beaker-puppet_install_helper" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
require 'rubygems' | ||
require 'bundler/setup' | ||
|
||
require 'puppetlabs_spec_helper/rake_tasks' | ||
require 'puppet/version' | ||
require 'puppet/vendor/semantic/lib/semantic' unless Puppet.version.to_f < 3.6 | ||
require 'puppet-lint/tasks/puppet-lint' | ||
require 'puppet-syntax/tasks/puppet-syntax' | ||
require 'metadata-json-lint/rake_task' | ||
require 'rubocop/rake_task' | ||
|
||
# These gems aren't always present, for instance | ||
# on Travis with --without development | ||
begin | ||
require 'puppet_blacksmith/rake_tasks' | ||
rescue LoadError # rubocop:disable Lint/HandleExceptions | ||
end | ||
|
||
RuboCop::RakeTask.new | ||
|
||
exclude_paths = [ | ||
"bundle/**/*", | ||
"pkg/**/*", | ||
"vendor/**/*", | ||
"spec/**/*", | ||
] | ||
|
||
# Coverage from puppetlabs-spec-helper requires rcov which | ||
# doesn't work in anything since 1.8.7 | ||
Rake::Task[:coverage].clear | ||
|
||
Rake::Task[:lint].clear | ||
|
||
PuppetLint.configuration.relative = true | ||
PuppetLint.configuration.disable_80chars | ||
PuppetLint.configuration.disable_class_inherits_from_params_class | ||
PuppetLint.configuration.disable_class_parameter_defaults | ||
PuppetLint.configuration.fail_on_warnings = true | ||
|
||
PuppetLint::RakeTask.new :lint do |config| | ||
config.ignore_paths = exclude_paths | ||
end | ||
|
||
PuppetSyntax.exclude_paths = exclude_paths | ||
|
||
desc "Run acceptance tests" | ||
RSpec::Core::RakeTask.new(:acceptance) do |t| | ||
t.pattern = 'spec/acceptance' | ||
end | ||
|
||
desc "Populate CONTRIBUTORS file" | ||
task :contributors do | ||
system("git log --format='%aN' | sort -u > CONTRIBUTORS") | ||
end | ||
|
||
desc "Run syntax, lint, and spec tests." | ||
task :test => [ | ||
:metadata_lint, | ||
:syntax, | ||
:lint, | ||
:rubocop, | ||
:spec, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'spec_helper' | ||
|
||
describe 'change_window' do | ||
it { is_expected.not_to eq(nil) } | ||
it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError) } | ||
it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError) } | ||
it { is_expected.to run.with_params("-05:00",'per_day',{'start'=>0,'end'=>6},{'start'=>['00','00'],'end'=>['23','59']}).and_return("true") } | ||
it { is_expected.to run.with_params("-05:00",'window',{'start'=>0,'end'=>6},{'start'=>['00','00'],'end'=>['23','59']}).and_return("true") } | ||
it { is_expected.to run.with_params("-05:00",'per_day',{'start'=>0,'end'=>0},{'start'=>['00','00'],'end'=>['00','01']}).and_return("false") } | ||
it { is_expected.to run.with_params("-05:00",'window',{'start'=>0,'end'=>0},{'start'=>['00','00'],'end'=>['00','01']}).and_return("false") } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'puppetlabs_spec_helper/module_spec_helper' | ||
require 'rspec-puppet-facts' | ||
|
||
include RspecPuppetFacts | ||
|
||
require 'simplecov' | ||
require 'simplecov-console' | ||
|
||
SimpleCov.start do | ||
add_filter '/spec' | ||
add_filter '/vendor' | ||
formatter SimpleCov::Formatter::MultiFormatter.new([ | ||
SimpleCov::Formatter::HTMLFormatter, | ||
SimpleCov::Formatter::Console | ||
]) | ||
end |