From a6e85ced1e2cdd5c51dfce4df76e1715dd346796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Tue, 19 Oct 2021 13:15:37 -1000 Subject: [PATCH] Pet Rubocop --- spec/classes/repo_spec.rb | 20 +++++++++++--------- spec/spec_helper.rb | 10 +++++----- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/spec/classes/repo_spec.rb b/spec/classes/repo_spec.rb index 409c4fd..c5a44ed 100644 --- a/spec/classes/repo_spec.rb +++ b/spec/classes/repo_spec.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + require 'spec_helper' def url(format, version) case version when %r{^2} - repo_type = (format == 'yum') ? 'centos' : 'debian' + repo_type = format == 'yum' ? 'centos' : 'debian' "https://packages.elastic.co/elasticsearch/#{version}/#{repo_type}" else "https://artifacts.elastic.co/packages/#{version}/#{format}" @@ -44,7 +46,7 @@ def declare_zypper(version: '7.x', **params) it { is_expected.to contain_exec('elastic_zypper_refresh_elastic').with(command: 'zypper refresh elastic') } end - context 'with "version => 2"' do + context 'with "version => 2"' do # rubocop:disable RSpec/EmptyExampleGroup let(:params) { default_params.merge(version: 2) } case facts[:os]['family'] @@ -57,7 +59,7 @@ def declare_zypper(version: '7.x', **params) end end - context 'with "version => 5"' do + context 'with "version => 5"' do # rubocop:disable RSpec/EmptyExampleGroup let(:params) { default_params.merge(version: 5) } case facts[:os]['family'] @@ -70,7 +72,7 @@ def declare_zypper(version: '7.x', **params) end end - context 'with "version => 6"' do + context 'with "version => 6"' do # rubocop:disable RSpec/EmptyExampleGroup let(:params) { default_params.merge(version: 6) } case facts[:os]['family'] @@ -83,7 +85,7 @@ def declare_zypper(version: '7.x', **params) end end - context 'with "priority => 99"' do + context 'with "priority => 99"' do # rubocop:disable RSpec/EmptyExampleGroup let(:params) { default_params.merge(priority: 99) } case facts[:os]['family'] @@ -96,7 +98,7 @@ def declare_zypper(version: '7.x', **params) end end - context 'with "prerelease => true"' do + context 'with "prerelease => true"' do # rubocop:disable RSpec/EmptyExampleGroup let(:params) { default_params.merge(prerelease: true) } case facts[:os]['family'] @@ -109,7 +111,7 @@ def declare_zypper(version: '7.x', **params) end end - context 'with "oss => true"' do + context 'with "oss => true"' do # rubocop:disable RSpec/EmptyExampleGroup let(:params) { default_params.merge(oss: true) } case facts[:os]['family'] @@ -122,7 +124,7 @@ def declare_zypper(version: '7.x', **params) end end - context 'with "oss and prerelease => true"' do + context 'with "oss and prerelease => true"' do # rubocop:disable RSpec/EmptyExampleGroup let(:params) { default_params.merge(oss: true, prerelease: true) } case facts[:os]['family'] @@ -135,7 +137,7 @@ def declare_zypper(version: '7.x', **params) end end - context 'with base_repo_url parameter' do + context 'with base_repo_url parameter' do # rubocop:disable RSpec/EmptyExampleGroup let(:params) { default_params.merge(base_repo_url: 'https://mymirror.example.org/elastic-artifacts/packages') } case facts[:os]['family'] diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fb5f0cb..4d617f3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,17 +1,17 @@ +# frozen_string_literal: true + # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ # puppetlabs_spec_helper will set up coverage if the env variable is set. # We want to do this if lib exists and it hasn't been explicitly set. -ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../../lib', __FILE__)) +ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) require 'voxpupuli/test/spec_helper' if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) - if facts - facts.each do |name, value| - add_custom_fact name.to_sym, value - end + facts&.each do |name, value| + add_custom_fact name.to_sym, value end end