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
293d591c
Commit
293d591c
authored
Jun 25, 2019
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set 2 weeks as the expiration time for the current broadcast message
parent
a54b874e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
app/models/broadcast_message.rb
app/models/broadcast_message.rb
+1
-1
ee/spec/models/broadcast_message_spec.rb
ee/spec/models/broadcast_message_spec.rb
+7
-7
spec/models/broadcast_message_spec.rb
spec/models/broadcast_message_spec.rb
+3
-3
No files found.
app/models/broadcast_message.rb
View file @
293d591c
...
...
@@ -45,7 +45,7 @@ class BroadcastMessage < ApplicationRecord
end
def
self
.
cache_expires_in
nil
2
.
weeks
end
def
active?
...
...
ee/spec/models/broadcast_message_spec.rb
View file @
293d591c
...
...
@@ -5,16 +5,16 @@ describe BroadcastMessage do
describe
'.current'
,
:use_clean_rails_memory_store_caching
do
context
'without Geo'
do
it
'caches the output
for a long time
'
do
it
'caches the output
of the query for two weeks
'
do
expect
(
Gitlab
::
Geo
).
to
receive
(
:enabled?
).
and_return
(
false
).
exactly
(
2
).
times
create
(
:broadcast_message
)
expect
(
described_class
).
to
receive
(
:
where
).
and_call_original
.
on
ce
expect
(
described_class
).
to
receive
(
:
current_and_future_messages
).
and_call_original
.
twi
ce
described_class
.
current
Timecop
.
travel
(
1
.
year
)
do
Timecop
.
travel
(
3
.
weeks
)
do
described_class
.
current
end
end
...
...
@@ -22,16 +22,16 @@ describe BroadcastMessage do
context
'with Geo'
do
context
'on the primary'
do
it
'caches the output
for a long time
'
do
expect
(
Gitlab
::
Geo
).
to
receive
(
:
secondary
?
).
and_return
(
false
).
exactly
(
2
).
times
it
'caches the output
of the query for two weeks
'
do
expect
(
Gitlab
::
Geo
).
to
receive
(
:
enabled
?
).
and_return
(
false
).
exactly
(
2
).
times
create
(
:broadcast_message
)
expect
(
described_class
).
to
receive
(
:
where
).
and_call_original
.
on
ce
expect
(
described_class
).
to
receive
(
:
current_and_future_messages
).
and_call_original
.
twi
ce
described_class
.
current
Timecop
.
travel
(
1
.
year
)
do
Timecop
.
travel
(
3
.
weeks
)
do
described_class
.
current
end
end
...
...
spec/models/broadcast_message_spec.rb
View file @
293d591c
...
...
@@ -48,14 +48,14 @@ describe BroadcastMessage do
expect
(
described_class
.
current
).
to
be_empty
end
it
'caches the output of the query'
do
it
'caches the output of the query
for two weeks
'
do
create
(
:broadcast_message
)
expect
(
described_class
).
to
receive
(
:current_and_future_messages
).
and_call_original
.
on
ce
expect
(
described_class
).
to
receive
(
:current_and_future_messages
).
and_call_original
.
twi
ce
described_class
.
current
Timecop
.
travel
(
1
.
year
)
do
Timecop
.
travel
(
3
.
weeks
)
do
described_class
.
current
end
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