summaryrefslogtreecommitdiff
path: root/spec/rubocop
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-09-07 13:29:19 +0100
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-09-24 12:02:01 +0100
commit81d949f656979429835e0b6059a10a44faba488b (patch)
tree671a8927eab32278c656cb24e220ea4df41abd30 /spec/rubocop
parent4ce9f2fdfb6d135e6229675b9965c1b90efdfcfe (diff)
downloadgitlab-ce-81d949f656979429835e0b6059a10a44faba488b.tar.gz
Applies the CE backport of EE#657
Diffstat (limited to 'spec/rubocop')
-rw-r--r--spec/rubocop/cop/group_public_or_visible_to_user_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/rubocop/cop/group_public_or_visible_to_user_spec.rb b/spec/rubocop/cop/group_public_or_visible_to_user_spec.rb
new file mode 100644
index 00000000000..7b5235a3da7
--- /dev/null
+++ b/spec/rubocop/cop/group_public_or_visible_to_user_spec.rb
@@ -0,0 +1,28 @@
+require 'spec_helper'
+require 'rubocop'
+require 'rubocop/rspec/support'
+require_relative '../../../rubocop/cop/group_public_or_visible_to_user'
+
+describe RuboCop::Cop::GroupPublicOrVisibleToUser do
+ include CopHelper
+
+ subject(:cop) { described_class.new }
+
+ it 'flags the use of Group.public_or_visible_to_user with a constant receiver' do
+ inspect_source('Group.public_or_visible_to_user')
+
+ expect(cop.offenses.size).to eq(1)
+ end
+
+ it 'does not flat the use of public_or_visible_to_user with a constant that is not Group' do
+ inspect_source('Project.public_or_visible_to_user')
+
+ expect(cop.offenses.size).to eq(0)
+ end
+
+ it 'does not flag the use of Group.public_or_visible_to_user with a send receiver' do
+ inspect_source('foo.public_or_visible_to_user')
+
+ expect(cop.offenses.size).to eq(0)
+ end
+end