diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-18 00:11:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-18 00:11:29 +0300 |
commit | a0b4a462b0c6f333651ae9e0c0ca1e5794e7b4e1 (patch) | |
tree | 37dce5303162eaf08841616347de9f65ba8dabf7 /spec/rubocop | |
parent | e388691e4a5b5b69be903c7eceb606b853719cd5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop')
-rw-r--r-- | spec/rubocop/cop/user_admin_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/rubocop/cop/user_admin_spec.rb b/spec/rubocop/cop/user_admin_spec.rb new file mode 100644 index 00000000000..3bf458348f3 --- /dev/null +++ b/spec/rubocop/cop/user_admin_spec.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +require 'fast_spec_helper' + +require 'rubocop' +require_relative '../../../rubocop/cop/user_admin' + +RSpec.describe RuboCop::Cop::UserAdmin do + subject(:cop) { described_class.new } + + it 'flags a method call' do + expect_offense(<<~SOURCE) + user.admin? + ^^^^^^ #{described_class::MSG} + SOURCE + end + + it 'flags a method call with safe operator' do + expect_offense(<<~SOURCE) + user&.admin? + ^^^^^^ #{described_class::MSG} + SOURCE + end +end |