Skip to content

Commit

Permalink
Adjust unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasAud committed Jul 27, 2023
1 parent 3d7e939 commit bea0e5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 47 deletions.
Empty file modified lib/puppet-lint/plugins/top_scope_facts/top_scope_facts.rb
100755 → 100644
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,10 @@
end

context 'fact variable using top scope' do
let(:code) { '$::operatingsystem' }
let(:code) { '$::fqdn' }

it 'onlies detect a single problem' do
expect(problems).to have(1).problem
end

it 'creates a warning' do
expect(problems).to contain_warning(msg).on_line(1).in_column(1)
end
end

context 'fact variable using top scope with curly braces in double quote' do
let(:code) { '"${::operatingsystem}"' }

it 'onlies detect a single problem' do
expect(problems).to have(1).problem
end

it 'creates a warning' do
expect(problems).to contain_warning(msg).on_line(1).in_column(4)
it 'does not detect a single problem' do
expect(problems).to have(0).problem
end
end

Expand Down Expand Up @@ -126,34 +110,6 @@
end
end

context 'fact variable using top scope' do
let(:code) { '$::operatingsystem' }

it 'onlies detect a single problem' do
expect(problems).to have(1).problem
end

it 'fixes the problem' do
expect(problems).to contain_fixed(msg).on_line(1).in_column(1)
end

it 'shoulds use the facts hash' do
expect(manifest).to eq("$facts['operatingsystem']")
end
end

context 'fact variable using top scope with curly braces in double quote' do
let(:code) { '"${::operatingsystem}"' }

it 'fixes the problem' do
expect(problems).to contain_fixed(msg).on_line(1).in_column(4)
end

it 'shoulds use the facts hash' do
expect(manifest).to eq('"${facts[\'operatingsystem\']}"')
end
end

context 'with custom top scope fact variables' do
before(:each) do
PuppetLint.configuration.top_scope_variables = ['location', 'role']
Expand Down

0 comments on commit bea0e5a

Please sign in to comment.