Make sure it's not offending to use local ||= val

This commit is contained in:
Lin Jen-Shin 2018-01-13 00:17:30 +08:00
parent 72c489e9e4
commit d6c69373e5
1 changed files with 14 additions and 0 deletions

View File

@ -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