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:
Diffstat (limited to 'spec/rubocop/cop/group_public_or_visible_to_user_spec.rb')
-rw-r--r--spec/rubocop/cop/group_public_or_visible_to_user_spec.rb23
1 files changed, 11 insertions, 12 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
index ac6c481a7c3..b3ec426dc07 100644
--- a/spec/rubocop/cop/group_public_or_visible_to_user_spec.rb
+++ b/spec/rubocop/cop/group_public_or_visible_to_user_spec.rb
@@ -2,29 +2,28 @@
require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
require_relative '../../../rubocop/cop/group_public_or_visible_to_user'
RSpec.describe RuboCop::Cop::GroupPublicOrVisibleToUser do
- include CopHelper
+ let(:msg) do
+ "`Group.public_or_visible_to_user` should be used with extreme care. " \
+ "Please ensure that you are not using it on its own and that the amount of rows being filtered is reasonable."
+ end
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)
+ expect_offense(<<~CODE)
+ Group.public_or_visible_to_user
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #{msg}
+ CODE
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)
+ it 'does not flag the use of public_or_visible_to_user with a constant that is not Group' do
+ expect_no_offenses('Project.public_or_visible_to_user')
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)
+ expect_no_offenses('foo.public_or_visible_to_user')
end
end