Skip to content

Commit bea0e5a

Browse files
committed
Adjust unit tests
1 parent 3d7e939 commit bea0e5a

File tree

2 files changed

+3
-47
lines changed

2 files changed

+3
-47
lines changed

lib/puppet-lint/plugins/top_scope_facts/top_scope_facts.rb

100755100644
File mode changed.

spec/unit/puppet-lint/plugins/top_scope_facts/top_scope_facts_spec.rb

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,10 @@
3737
end
3838

3939
context 'fact variable using top scope' do
40-
let(:code) { '$::operatingsystem' }
40+
let(:code) { '$::fqdn' }
4141

42-
it 'onlies detect a single problem' do
43-
expect(problems).to have(1).problem
44-
end
45-
46-
it 'creates a warning' do
47-
expect(problems).to contain_warning(msg).on_line(1).in_column(1)
48-
end
49-
end
50-
51-
context 'fact variable using top scope with curly braces in double quote' do
52-
let(:code) { '"${::operatingsystem}"' }
53-
54-
it 'onlies detect a single problem' do
55-
expect(problems).to have(1).problem
56-
end
57-
58-
it 'creates a warning' do
59-
expect(problems).to contain_warning(msg).on_line(1).in_column(4)
42+
it 'does not detect a single problem' do
43+
expect(problems).to have(0).problem
6044
end
6145
end
6246

@@ -126,34 +110,6 @@
126110
end
127111
end
128112

129-
context 'fact variable using top scope' do
130-
let(:code) { '$::operatingsystem' }
131-
132-
it 'onlies detect a single problem' do
133-
expect(problems).to have(1).problem
134-
end
135-
136-
it 'fixes the problem' do
137-
expect(problems).to contain_fixed(msg).on_line(1).in_column(1)
138-
end
139-
140-
it 'shoulds use the facts hash' do
141-
expect(manifest).to eq("$facts['operatingsystem']")
142-
end
143-
end
144-
145-
context 'fact variable using top scope with curly braces in double quote' do
146-
let(:code) { '"${::operatingsystem}"' }
147-
148-
it 'fixes the problem' do
149-
expect(problems).to contain_fixed(msg).on_line(1).in_column(4)
150-
end
151-
152-
it 'shoulds use the facts hash' do
153-
expect(manifest).to eq('"${facts[\'operatingsystem\']}"')
154-
end
155-
end
156-
157113
context 'with custom top scope fact variables' do
158114
before(:each) do
159115
PuppetLint.configuration.top_scope_variables = ['location', 'role']

0 commit comments

Comments
 (0)