Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorick@yorickpeterse.com>2019-08-28 18:20:06 +0300
committerYorick Peterse <yorick@yorickpeterse.com>2019-08-28 18:20:06 +0300
commit5445f71e608b7dd5dac068006a578b32fabdf6ac (patch)
tree8b000c448e06c340fee111edba5f1f19f5d4cf6b /spec/rubocop
parent4b23faab2c4428a9cde7f16a08b3e6059069890c (diff)
Fix InjectEnterpriseEditionModule cop for qa/
This ensures the InjectEnterpriseEditionModule cop is able to detect the prepend patterns used in the qa/ directory. Previously it would not detect them as all EE QA modules reside in QA::EE, and not the top-level EE namespace.
Diffstat (limited to 'spec/rubocop')
-rw-r--r--spec/rubocop/cop/inject_enterprise_edition_module_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/rubocop/cop/inject_enterprise_edition_module_spec.rb b/spec/rubocop/cop/inject_enterprise_edition_module_spec.rb
index 27df42c0aee..ce20d494542 100644
--- a/spec/rubocop/cop/inject_enterprise_edition_module_spec.rb
+++ b/spec/rubocop/cop/inject_enterprise_edition_module_spec.rb
@@ -19,6 +19,15 @@ describe RuboCop::Cop::InjectEnterpriseEditionModule do
SOURCE
end
+ it 'flags the use of `prepend_if_ee QA::EE` in the middle of a file' do
+ expect_offense(<<~SOURCE)
+ class Foo
+ prepend_if_ee 'QA::EE::Foo'
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Injecting EE modules must be done on the last line of this file, outside of any class or module definitions
+ end
+ SOURCE
+ end
+
it 'does not flag the use of `prepend_if_ee EEFoo` in the middle of a file' do
expect_no_offenses(<<~SOURCE)
class Foo
@@ -176,6 +185,16 @@ describe RuboCop::Cop::InjectEnterpriseEditionModule do
SOURCE
end
+ it 'disallows the use of prepend to inject a QA::EE module' do
+ expect_offense(<<~SOURCE)
+ class Foo
+ end
+
+ Foo.prepend(QA::EE::Foo)
+ ^^^^^^^^^^^^^^^^^^^^^^^^ EE modules must be injected using `include_if_ee`, `extend_if_ee`, or `prepend_if_ee`
+ SOURCE
+ end
+
it 'disallows the use of extend to inject an EE module' do
expect_offense(<<~SOURCE)
class Foo