Giuseppe Lavagetto has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/382413 )

Change subject: Add tests for a bad defined type
......................................................................

Add tests for a bad defined type

Change-Id: I2b5a4931754ec8b0e614607a69c841d890c2ce37
---
M Rakefile
M spec/puppet-lint/plugins/check_wmf_styleguide_check_spec.rb
2 files changed, 17 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/operations/puppet-lint/wmf_styleguide-check 
refs/changes/13/382413/1

diff --git a/Rakefile b/Rakefile
index 0045500..caea4eb 100644
--- a/Rakefile
+++ b/Rakefile
@@ -31,7 +31,7 @@
   # Only enable the wmf_styleguide
   PuppetLint.configuration.checks.each do |check|
     if check == :wmf_styleguide
-      PuppetLint.configuration.configuration.send('enable_wmf_styleguide')
+      PuppetLint.configuration.send('enable_wmf_styleguide')
     else
       PuppetLint.configuration.send("disable_#{check}")
     end
diff --git a/spec/puppet-lint/plugins/check_wmf_styleguide_check_spec.rb 
b/spec/puppet-lint/plugins/check_wmf_styleguide_check_spec.rb
index 3580c71..28a204c 100644
--- a/spec/puppet-lint/plugins/check_wmf_styleguide_check_spec.rb
+++ b/spec/puppet-lint/plugins/check_wmf_styleguide_check_spec.rb
@@ -64,6 +64,13 @@
 )
 EOF
 
+define_ko = <<-EOF
+define foo::fixme ($a=hiera('something')) {
+       include ::foo
+       class { '::bar': }
+}
+EOF
+
 describe 'wmf_styleguide' do
   context 'class correctly written' do
     let(:code) { class_ok }
@@ -126,4 +133,13 @@
       expect(problems).to have(0).problems
     end
   end
+  context 'defined type with violations' do
+    let(:code) { define_ko }
+    it 'should not contain hiera calls' do
+      expect(problems).to contain_error("wmf-style: Found hiera call in 
defined type 'foo::fixme'").on_line(1)
+    end
+    it 'should not include or define any class' do
+      expect(problems).to contain_error("wmf-style: defined type 'foo::fixme' 
declares class bar from another module").on_line(3)
+    end
+  end
 end

-- 
To view, visit https://gerrit.wikimedia.org/r/382413
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b5a4931754ec8b0e614607a69c841d890c2ce37
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet-lint/wmf_styleguide-check
Gerrit-Branch: master
Gerrit-Owner: Giuseppe Lavagetto <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to