blob: b5017bebd286498c3b8e81689836136a47b2928f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# frozen_string_literal: true
require 'rubocop_spec_helper'
require_relative '../../../../rubocop/cop/gitlab/avoid_feature_get'
RSpec.describe RuboCop::Cop::Gitlab::AvoidFeatureGet do
let(:msg) { described_class::MSG }
subject(:cop) { described_class.new }
it 'bans use of Feature.ban' do
expect_offense(<<~RUBY)
Feature.get
^^^ #{msg}
Feature.get(x)
^^^ #{msg}
::Feature.get
^^^ #{msg}
::Feature.get(x)
^^^ #{msg}
RUBY
end
it 'ignores unrelated code' do
expect_no_offenses(<<~RUBY)
Namespace::Feature.get
Namespace::Feature.get(x)
Feature.remove(:x)
RUBY
end
end
|