debian-mirror-gitlab/spec/rubocop/cop/user_admin_spec.rb
2023-03-04 22:38:38 +05:30

20 lines
455 B
Ruby

# frozen_string_literal: true
require 'rubocop_spec_helper'
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