Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2019-09-04 11:14:24 +0300
committerNick Thomas <nick@gitlab.com>2019-09-10 15:45:21 +0300
commit6ce21a9c1712c4c64b628fd65207c2f8eb7fc39d (patch)
tree2e9a7734fd35da00465a256b4a6e413731fd07cf /spec/lib
parent96a9a140e8382997687a7a10afc616a8fb8281ed (diff)
Add a predicate to check for strong memoization
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/utils/strong_memoize_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/lib/gitlab/utils/strong_memoize_spec.rb b/spec/lib/gitlab/utils/strong_memoize_spec.rb
index 26baaf873a8..624e799c5e9 100644
--- a/spec/lib/gitlab/utils/strong_memoize_spec.rb
+++ b/spec/lib/gitlab/utils/strong_memoize_spec.rb
@@ -52,6 +52,22 @@ describe Gitlab::Utils::StrongMemoize do
end
end
+ describe '#strong_memoized?' do
+ let(:value) { :anything }
+
+ subject { object.strong_memoized?(:method_name) }
+
+ it 'returns false if the value is uncached' do
+ is_expected.to be(false)
+ end
+
+ it 'returns true if the value is cached' do
+ object.method_name
+
+ is_expected.to be(true)
+ end
+ end
+
describe '#clear_memoization' do
let(:value) { 'mepmep' }