2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
require 'fast_spec_helper'
|
2018-11-08 19:23:39 +05:30
|
|
|
require 'rubocop'
|
|
|
|
require 'rubocop/rspec/support'
|
|
|
|
require_relative '../../../rubocop/cop/group_public_or_visible_to_user'
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
RSpec.describe RuboCop::Cop::GroupPublicOrVisibleToUser do
|
2018-11-08 19:23:39 +05:30
|
|
|
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
|