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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
bf921d08
Commit
bf921d08
authored
Mar 04, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Invalidate cache for builds badge
Closes #13982
parent
f8c4dc97
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
app/controllers/projects/badges_controller.rb
app/controllers/projects/badges_controller.rb
+13
-0
features/project/badges/build.feature
features/project/badges/build.feature
+5
-0
features/steps/project/badges/build.rb
features/steps/project/badges/build.rb
+4
-0
No files found.
app/controllers/projects/badges_controller.rb
View file @
bf921d08
class
Projects::BadgesController
<
Projects
::
ApplicationController
before_action
:set_no_cache
def
build
respond_to
do
|
format
|
format
.
html
{
render_404
}
...
...
@@ -8,4 +10,15 @@ class Projects::BadgesController < Projects::ApplicationController
end
end
end
private
def
set_no_cache
expires_now
# Add some deprecated headers for older agents
#
response
.
headers
[
'Pragma'
]
=
'no-cache'
response
.
headers
[
'Expires'
]
=
'Fri, 01 Jan 1990 00:00:00 GMT'
end
end
features/project/badges/build.feature
View file @
bf921d08
...
...
@@ -20,3 +20,8 @@ Feature: Project Badges Build
And
project has another build that is running
When
I display builds badge for a master branch
Then
I should see a build running badge
Scenario
:
I
want to see a fresh badge on each request
Given
recent build is successful
When
I display builds badge for a master branch
Then
I should see a badge that has not been cached
features/steps/project/badges/build.rb
View file @
bf921d08
...
...
@@ -20,6 +20,10 @@ class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps
expect_badge
(
'running'
)
end
step
'I should see a badge that has not been cached'
do
expect
(
page
.
response_headers
).
to
include
(
'Cache-Control'
=>
'no-cache'
)
end
def
expect_badge
(
status
)
svg
=
Nokogiri
::
XML
.
parse
(
page
.
body
)
expect
(
page
.
response_headers
).
to
include
(
'Content-Type'
=>
'image/svg+xml'
)
...
...
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