From a33f132022f9f2b2b9582f5a7e841e917eb26ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 4 Sep 2023 13:42:26 -1000 Subject: [PATCH] Pet rubocop --- .../plugins/topscope_variable_spec.rb | 54 +++++++++++-------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/spec/puppet-lint/plugins/topscope_variable_spec.rb b/spec/puppet-lint/plugins/topscope_variable_spec.rb index 48139a4..baf0b61 100644 --- a/spec/puppet-lint/plugins/topscope_variable_spec.rb +++ b/spec/puppet-lint/plugins/topscope_variable_spec.rb @@ -153,6 +153,16 @@ class foo::blub { PUP end + let(:fixed) do + <<~PUP + class foo::blub { + notify { 'foo': + message => $foo::bar + } + } + PUP + end + it 'detects one problem' do expect(problems).to have(1).problem end @@ -162,13 +172,7 @@ class foo::blub { end it 'removes :: after the $' do - expect(manifest).to eq <<~PUP - class foo::blub { - notify { 'foo': - message => $foo::bar - } - } - PUP + expect(manifest).to eq fixed end end @@ -183,6 +187,16 @@ class profile::foo { PUP end + let(:fixed) do + <<~PUP + class profile::foo { + notify { 'foo': + message => $some_component_module::bar + } + } + PUP + end + it 'detects one problem' do expect(problems).to have(1).problem end @@ -192,13 +206,7 @@ class profile::foo { end it 'removes :: after the $' do - expect(manifest).to eq <<~PUP - class profile::foo { - notify { 'foo': - message => $some_component_module::bar - } - } - PUP + expect(manifest).to eq fixed end end @@ -213,6 +221,16 @@ class foo::blub { PUP end + let(:fixed) do + <<~PUP + class foo::blub { + notify { 'foo': + message => ">${foo::bar}<" + } + } + PUP + end + it 'detects one problem' do expect(problems).to have(1).problem end @@ -222,13 +240,7 @@ class foo::blub { end it 'removes :: after the $' do - expect(manifest).to eq <<~PUP - class foo::blub { - notify { 'foo': - message => ">${foo::bar}<" - } - } - PUP + expect(manifest).to eq fixed end end end