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
f4aa0105
Commit
f4aa0105
authored
May 30, 2017
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test etag cache key changing value
parent
7ec89692
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
app/models/environment.rb
app/models/environment.rb
+7
-2
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+12
-0
No files found.
app/models/environment.rb
View file @
f4aa0105
...
@@ -202,11 +202,16 @@ class Environment < ActiveRecord::Base
...
@@ -202,11 +202,16 @@ class Environment < ActiveRecord::Base
def
expire_etag_cache
def
expire_etag_cache
Gitlab
::
EtagCaching
::
Store
.
new
.
tap
do
|
store
|
Gitlab
::
EtagCaching
::
Store
.
new
.
tap
do
|
store
|
store
.
touch
(
Gitlab
::
Routing
.
url_helpers
store
.
touch
(
etag_cache_key
)
.
namespace_project_environments_path
(
project
.
namespace
,
project
))
end
end
end
end
def
etag_cache_key
Gitlab
::
Routing
.
url_helpers
.
namespace_project_environments_path
(
project
.
namespace
,
project
)
end
private
private
# Slugifying a name may remove the uniqueness guarantee afforded by it being
# Slugifying a name may remove the uniqueness guarantee afforded by it being
...
...
spec/models/environment_spec.rb
View file @
f4aa0105
...
@@ -42,6 +42,18 @@ describe Environment, models: true do
...
@@ -42,6 +42,18 @@ describe Environment, models: true do
end
end
end
end
describe
'#expire_etag_cache'
do
let
(
:store
)
{
Gitlab
::
EtagCaching
::
Store
.
new
}
it
'changes the cached value'
do
old_value
=
store
.
get
(
environment
.
etag_cache_key
)
environment
.
stop
expect
(
store
.
get
(
environment
.
etag_cache_key
)).
not_to
eq
(
old_value
)
end
end
describe
'#nullify_external_url'
do
describe
'#nullify_external_url'
do
it
'replaces a blank url with nil'
do
it
'replaces a blank url with nil'
do
env
=
build
(
:environment
,
external_url:
""
)
env
=
build
(
:environment
,
external_url:
""
)
...
...
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