summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/rubocop/cop/gitlab/predicate_memoization_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/rubocop/cop/gitlab/predicate_memoization_spec.rb b/spec/rubocop/cop/gitlab/predicate_memoization_spec.rb
index 6c731139468..21fc4584654 100644
--- a/spec/rubocop/cop/gitlab/predicate_memoization_spec.rb
+++ b/spec/rubocop/cop/gitlab/predicate_memoization_spec.rb
@@ -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