From a3e2a04d24e7500be442a010c6c74f76ac23c3d1 Mon Sep 17 00:00:00 2001 From: kreczko Date: Thu, 18 May 2017 17:01:01 +0100 Subject: [PATCH] fixing rspec warnings --- .travis.yml | 13 +++++++------ Gemfile | 23 +++++++++++++++++++++-- Rakefile | 5 +++-- manifests/service.pp | 6 ++++-- metadata.json | 6 +++--- spec/spec_helper.rb | 4 +++- 6 files changed, 41 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 668fb85..d4e5c10 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,18 @@ --- +sudo: false language: ruby +cache: bundler bundler_args: --without development script: - - puppet --version - "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" matrix: fast_finish: true include: - - rvm: 1.9.3 + - rvm: 2.1.7 env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.1.5 - env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.1.6 - env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes" + - rvm: 2.1.7 + env: PUPPET_GEM_VERSION="~> 4.0" + - rvm: 2.3.1 + env: PUPPET_GEM_VERSION="~> 4.0" notifications: email: false diff --git a/Gemfile b/Gemfile index d56416a..93bbcca 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,26 @@ source 'https://rubygems.org' -puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7'] -gem 'puppet', puppetversion +# Find a location or specific version for a gem. place_or_version can be a +# version, which is most often used. It can also be git, which is specified as +# `git://somewhere.git#branch`. You can also use a file source location, which +# is specified as `file://some/location/on/disk`. +def location_for(place_or_version, fake_version = nil) + if place_or_version =~ /^(git[:@][^#]*)#(.*)/ + [fake_version, { :git => $1, :branch => $2, :require => false }].compact + elsif place_or_version =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path($1), :require => false }] + else + [place_or_version, { :require => false }] + end +end + +supports_windows = false + +gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION']) gem 'puppet-lint', '~> 2.0' gem 'puppetlabs_spec_helper', '~> 2.1' gem 'github_changelog_generator', '<= 1.14.3' +gem 'rspec-puppet', '~> 2.5' +gem 'rspec-puppet-facts' +gem 'rspec-puppet-utils' +gem 'metadata-json-lint' diff --git a/Rakefile b/Rakefile index 3c30d48..c7d19bd 100644 --- a/Rakefile +++ b/Rakefile @@ -2,11 +2,12 @@ require 'rubygems' require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' -PuppetLint.configuration.fail_on_warnings +PuppetLint.configuration.fail_on_warnings = true PuppetLint.configuration.send('relative') PuppetLint.configuration.send('disable_80chars') PuppetLint.configuration.send('disable_class_inherits_from_params_class') PuppetLint.configuration.send('disable_documentation') PuppetLint.configuration.send('disable_single_quote_string_with_variables') PuppetLint.configuration.send('disable_only_variable_string') -PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] +PuppetLint.configuration.ignore_paths = ["spec/**/*", "pkg/**/*", 'vendor/**/*'] +PuppetLint.configuration.exclude_paths = ["spec/**/*", "pkg/**/*", 'vendor/**/*'] diff --git a/manifests/service.pp b/manifests/service.pp index 930df9a..de3d8a9 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -8,9 +8,11 @@ hasrestart => true, hasstatus => true, } - -> - #this exec is called from the config, but we can't run it if the condor service is not up. it's a RE-config command assuming something is already up. + + # this exec is called from the config, but we can't run it if the condor + # service is not up. it's a RE-config command assuming something is already up. exec{ '/usr/sbin/condor_reconfig': refreshonly => true, + require => Service['condor'] } } diff --git a/metadata.json b/metadata.json index fcc5199..9ec3486 100644 --- a/metadata.json +++ b/metadata.json @@ -6,14 +6,14 @@ "dependencies": [ { "name": "puppetlabs/firewall", - "version_requirement": "\u003e\u003d0.3.1" + "version_requirement": "~> 1.8" }, { "name": "puppetlabs/stdlib", - "version_requirement": "\u003e\u003d4.1.0" + "version_requirement": "~> 4.1" } ], "source": "git@github.com:HEP-Puppet/puppet-htcondor.git", "project_page": "https://github.com/HEP-Puppet", - "license": "Apache License, Version 2.0" + "license": "Apache-2.0" } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2523411..b8bdc06 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,7 @@ require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet-utils' +require 'rspec/mocks' +require 'rspec-puppet-facts' # hack to enable all the expect syntax (like allow_any_instance_of) in rspec-puppet examples RSpec::Mocks::Syntax.enable_expect(RSpec::Puppet::ManifestMatchers) @@ -6,7 +9,6 @@ RSpec.configure do |c| c.add_setting :puppet_future c.puppet_future = Puppet.version.to_f >= 4.0 - c.treat_symbols_as_metadata_keys_with_true_values = true c.before :each do # Ensure that we don't accidentally cache facts and environment