summaryrefslogtreecommitdiff
path: root/spec/rubocop
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-01-13 00:17:30 +0800
committerLin Jen-Shin <godfat@godfat.org>2018-01-13 00:24:12 +0800
commitd6c69373e54b76232f361aa631e7b6283d3c71ef (patch)
tree06f74ce88f21c2deecfc5c638bcceeb1b285ad79 /spec/rubocop
parent72c489e9e4f2e2adac1da518cd632f1f4143d56e (diff)
downloadgitlab-ce-d6c69373e54b76232f361aa631e7b6283d3c71ef.tar.gz
Make sure it's not offending to use local ||= val
Diffstat (limited to 'spec/rubocop')
-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