Make sure it's not offending to use local ||= val
This commit is contained in:
parent
72c489e9e4
commit
d6c69373e5
1 changed files with 14 additions and 0 deletions
|
@ -70,6 +70,20 @@ describe RuboCop::Cop::Gitlab::PredicateMemoization do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when source is a predicate method using local with ||=' do
|
||||
it_behaves_like 'not registering offense' do
|
||||
let(:source) do
|
||||
<<~RUBY
|
||||
class C
|
||||
def really?
|
||||
really ||= true
|
||||
end
|
||||
end
|
||||
RUBY
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when source is a regular method memoizing via ivar' do
|
||||
it_behaves_like 'not registering offense' do
|
||||
let(:source) do
|
||||
|
|
Loading…
Reference in a new issue