Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
07f879f8
Commit
07f879f8
authored
Jul 01, 2019
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs in spec/models/concerns/cacheable_attributes_spec.rb
parent
978647c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
spec/models/concerns/cacheable_attributes_spec.rb
spec/models/concerns/cacheable_attributes_spec.rb
+5
-4
No files found.
spec/models/concerns/cacheable_attributes_spec.rb
View file @
07f879f8
...
...
@@ -143,14 +143,14 @@ describe CacheableAttributes do
allow
(
ApplicationSetting
).
to
receive
(
:current_without_cache
).
twice
.
and_return
(
nil
)
expect
(
ApplicationSetting
.
current
).
to
be_nil
expect
(
Rails
.
cache
.
exist?
(
ApplicationSetting
.
cache_key
)).
to
be
(
false
)
expect
(
ApplicationSetting
.
cache_backend
.
exist?
(
ApplicationSetting
.
cache_key
)).
to
be
(
false
)
end
it
'caches non-nil object'
do
create
(
:application_setting
)
expect
(
ApplicationSetting
.
current
).
to
eq
(
ApplicationSetting
.
last
)
expect
(
Rails
.
cache
.
exist?
(
ApplicationSetting
.
cache_key
)).
to
be
(
true
)
expect
(
ApplicationSetting
.
cache_backend
.
exist?
(
ApplicationSetting
.
cache_key
)).
to
be
(
true
)
# subsequent calls retrieve the record from the cache
last_record
=
ApplicationSetting
.
last
...
...
@@ -188,11 +188,12 @@ describe CacheableAttributes do
end
end
it
'uses RequestStore in addition to
Rails.
cache'
,
:request_store
do
it
'uses RequestStore in addition to
Thread memory
cache'
,
:request_store
do
# Warm up the cache
create
(
:application_setting
).
cache!
expect
(
Rails
.
cache
).
to
receive
(
:read
).
with
(
ApplicationSetting
.
cache_key
).
once
.
and_call_original
expect
(
ApplicationSetting
.
cache_backend
).
to
eq
(
Gitlab
::
ThreadMemoryCache
.
cache_backend
)
expect
(
ApplicationSetting
.
cache_backend
).
to
receive
(
:read
).
with
(
ApplicationSetting
.
cache_key
).
once
.
and_call_original
2
.
times
{
ApplicationSetting
.
current
}
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment