-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #672 from Darhazer/arrow-on-right-hand-operand-line
Check that arrow is on the line of right operand
- Loading branch information
Showing
2 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
spec/puppet-lint/plugins/check_classes/arrow_on_right_operand_line_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require 'spec_helper' | ||
|
||
describe 'arrow_on_right_operand_line' do | ||
{'chain' => '->', 'subscribe chain' => '~>'}.each do |name, operator| | ||
context "#{name} operator" do | ||
context 'both operands on same line' do | ||
let(:code) { "Package['httpd'] #{operator} Service['httpd']" } | ||
|
||
it { expect(problems).to have(0).problems } | ||
end | ||
|
||
context 'arrow on the line of left operand' do | ||
let(:code) do | ||
"Package['httpd'] #{operator} | ||
Service['httpd']" | ||
end | ||
|
||
it { expect(problems).to have(1).problems } | ||
|
||
context 'with fix enabled' do | ||
before do | ||
PuppetLint.configuration.fix = true | ||
end | ||
|
||
after do | ||
PuppetLint.configuration.fix = false | ||
end | ||
|
||
let(:fixed) do | ||
"Package['httpd'] | ||
#{operator} Service['httpd']" | ||
end | ||
|
||
it { expect(manifest).to eq (fixed) } | ||
end | ||
end | ||
|
||
context 'arrow on the line of right operand' do | ||
let(:code) { "Package['httpd'] | ||
#{operator} Service['httpd']" } | ||
|
||
it { expect(problems).to have(0).problems } | ||
end | ||
end | ||
end | ||
end |