Make sure it's not offending to use local ||= val
This commit is contained in:
parent
72c489e9e4
commit
d6c69373e5
|
@ -70,6 +70,20 @@ describe RuboCop::Cop::Gitlab::PredicateMemoization do
|
||||||
end
|
end
|
||||||
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
|
context 'when source is a regular method memoizing via ivar' do
|
||||||
it_behaves_like 'not registering offense' do
|
it_behaves_like 'not registering offense' do
|
||||||
let(:source) do
|
let(:source) do
|
||||||
|
|
Loading…
Reference in New Issue