From: david22swan Date: Wed, 26 Apr 2023 16:10:38 +0000 (+0100) Subject: (CONT-773) Rubocop Manual Fix 4 - Performance/CollectionLiteralInLoop X-Git-Tag: v9.1.0~9^2~3 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=46c94754d754cdf94fce800dd01cc48844b37ac8;p=puppet-modules%2Fpuppetlabs-apt.git (CONT-773) Rubocop Manual Fix 4 - Performance/CollectionLiteralInLoop --- diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 5c52997..e978cec 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -32,12 +32,6 @@ Metrics/MethodLength: Metrics/PerceivedComplexity: Max: 12 -# Offense count: 1 -# Configuration parameters: MinSize. -Performance/CollectionLiteralInLoop: - Exclude: - - 'spec/classes/apt_update_spec.rb' - # Offense count: 6 # Configuration parameters: Prefixes, AllowedPatterns. # Prefixes: when, with, without diff --git a/spec/classes/apt_update_spec.rb b/spec/classes/apt_update_spec.rb index ada31b1..ede2fe0 100644 --- a/spec/classes/apt_update_spec.rb +++ b/spec/classes/apt_update_spec.rb @@ -154,7 +154,8 @@ describe 'apt::update', type: :class do ['daily', 'weekly'].each do |update_frequency| context "when apt::update['frequency'] has the value of #{update_frequency}" do - { 'we are due for a run' => 1_406_660_561, 'the update-success-stamp file does not exist' => -1 }.each_pair do |desc, factval| + pair = { 'we are due for a run' => 1_406_660_561, 'the update-success-stamp file does not exist' => -1 } + pair.each_pair do |desc, factval| context "when $apt_update_last_success indicates #{desc}" do let(:facts) do {