diff --git a/Gemfile b/Gemfile index 09e4f60..b463c85 100644 --- a/Gemfile +++ b/Gemfile @@ -2,4 +2,4 @@ source 'https://rubygems.org' gem 'rake' gem 'serverspec' -gem 'rubocop', '~> 0.18.1' \ No newline at end of file +gem 'rubocop', '~> 0.23' \ No newline at end of file diff --git a/Rakefile b/Rakefile index c5d2a1f..54a1367 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,5 @@ +# encoding: utf-8 + require 'rake' require 'rspec/core/rake_task' require 'rubocop/rake_task' @@ -5,42 +7,38 @@ require 'rubocop/rake_task' # Rubocop desc 'Run Rubocop lint checks' task :rubocop do - Rubocop::RakeTask.new + RuboCop::RakeTask.new end # Lint the cookbook -desc "Run linters" -task :lint => [ :rubocop ] +desc 'Run linters' +task :run_all_linters => [:rubocop] # rubocop:disable Style/HashSyntax # Serverspec tests -suites = Dir.glob('*').select{|entry| File.directory?(entry) } +suites = Dir.glob('*').select { |entry| File.directory?(entry) } class ServerspecTask < RSpec::Core::RakeTask - attr_accessor :target def spec_command - - if target.nil? - puts "specify either env TARGET_HOST or target_host=" + if target.nil? + puts 'specify either env TARGET_HOST or target_host=' exit 1 end cmd = super "env TARGET_HOST=#{target} STANDALONE_SPEC=true #{cmd} --format documentation --no-profile" end - end namespace :serverspec do suites.each do |suite| desc "Run serverspec suite #{suite}" ServerspecTask.new(suite.to_sym) do |t| - t.rspec_opts = "--no-color --format html --out report.html" if ENV['format'] == 'html' + t.rspec_opts = '--no-color --format html --out report.html' if ENV['format'] == 'html' t.target = ENV['TARGET_HOST'] || ENV['target_host'] t.ruby_opts = "-I #{suite}/serverspec" t.pattern = "#{suite}/serverspec/*_spec.rb" end end end - diff --git a/default/serverspec/sysctl_spec.rb b/default/serverspec/sysctl_spec.rb index a0b9ca2..bc75d8d 100644 --- a/default/serverspec/sysctl_spec.rb +++ b/default/serverspec/sysctl_spec.rb @@ -120,7 +120,7 @@ describe 'IP V6 Networking' do context linux_kernel_parameter('net.ipv6.conf.all.disable_ipv6') do - its(:value) { should eq 1 } + its(:value) { should eq 1 } end # GIS: Req 3.21-1