debian-mirror-gitlab/spec/rubocop/cop/user_admin_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
474 B
Ruby
Raw Normal View History

2021-04-29 21:17:54 +05:30
# frozen_string_literal: true
2022-10-11 01:57:18 +05:30
require 'rubocop_spec_helper'
2021-04-29 21:17:54 +05:30
require 'rubocop'
require_relative '../../../rubocop/cop/user_admin'
RSpec.describe RuboCop::Cop::UserAdmin do
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