Skip to content

Commit

Permalink
Pet Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
smortex committed Oct 25, 2021
1 parent b7cb6f7 commit a6e85ce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
20 changes: 11 additions & 9 deletions spec/classes/repo_spec.rb
Original file line number Diff line number Diff line change
@@ -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}"
Expand Down Expand Up @@ -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']
Expand All @@ -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']
Expand All @@ -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']
Expand All @@ -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']
Expand All @@ -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']
Expand All @@ -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']
Expand All @@ -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']
Expand All @@ -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']
Expand Down
10 changes: 5 additions & 5 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a6e85ce

Please sign in to comment.