blob: d67b79329c9ea7f8608ab75a8139870328b65aff (
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
|
# frozen_string_literal: true
require 'rubocop_spec_helper'
require_relative '../../../rubocop/cop/avoid_becomes'
RSpec.describe RuboCop::Cop::AvoidBecomes do
it 'flags the use of becomes with a constant parameter' do
expect_offense(<<~CODE)
foo.becomes(Project)
^^^^^^^^^^^^^^^^^^^^ Avoid the use of becomes(SomeConstant), [...]
CODE
end
it 'flags the use of becomes with a namespaced constant parameter' do
expect_offense(<<~CODE)
foo.becomes(Namespace::Group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Avoid the use of becomes(SomeConstant), [...]
CODE
end
it 'flags the use of becomes with a dynamic parameter' do
expect_offense(<<~CODE)
model = Namespace
project = Project.first
project.becomes(model)
^^^^^^^^^^^^^^^^^^^^^^ Avoid the use of becomes(SomeConstant), [...]
CODE
end
end
|