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
Léo-Paul Géneau
gitlab-ce
Commits
660439e9
Commit
660439e9
authored
May 22, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce CE/EE diff in spec/controllers/projects/environments_controller_spec.rb
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
981b8ab7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
app/controllers/projects/environments_controller.rb
app/controllers/projects/environments_controller.rb
+10
-0
spec/controllers/projects/environments_controller_spec.rb
spec/controllers/projects/environments_controller_spec.rb
+7
-0
No files found.
app/controllers/projects/environments_controller.rb
View file @
660439e9
...
@@ -7,6 +7,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
...
@@ -7,6 +7,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
before_action
:authorize_admin_environment!
,
only:
[
:terminal
,
:terminal_websocket_authorize
]
before_action
:authorize_admin_environment!
,
only:
[
:terminal
,
:terminal_websocket_authorize
]
before_action
:environment
,
only:
[
:show
,
:edit
,
:update
,
:stop
,
:terminal
,
:terminal_websocket_authorize
,
:metrics
]
before_action
:environment
,
only:
[
:show
,
:edit
,
:update
,
:stop
,
:terminal
,
:terminal_websocket_authorize
,
:metrics
]
before_action
:verify_api_request!
,
only: :terminal_websocket_authorize
before_action
:verify_api_request!
,
only: :terminal_websocket_authorize
before_action
:expire_etag_cache
,
only:
[
:index
]
def
index
def
index
@environments
=
project
.
environments
@environments
=
project
.
environments
...
@@ -148,6 +149,15 @@ class Projects::EnvironmentsController < Projects::ApplicationController
...
@@ -148,6 +149,15 @@ class Projects::EnvironmentsController < Projects::ApplicationController
Gitlab
::
Workhorse
.
verify_api_request!
(
request
.
headers
)
Gitlab
::
Workhorse
.
verify_api_request!
(
request
.
headers
)
end
end
def
expire_etag_cache
return
if
request
.
format
.
json?
# this forces to reload json content
Gitlab
::
EtagCaching
::
Store
.
new
.
tap
do
|
store
|
store
.
touch
(
project_environments_path
(
project
,
format: :json
))
end
end
def
environment_params
def
environment_params
params
.
require
(
:environment
).
permit
(
:name
,
:external_url
)
params
.
require
(
:environment
).
permit
(
:name
,
:external_url
)
end
end
...
...
spec/controllers/projects/environments_controller_spec.rb
View file @
660439e9
...
@@ -21,6 +21,13 @@ describe Projects::EnvironmentsController do
...
@@ -21,6 +21,13 @@ describe Projects::EnvironmentsController do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'expires etag cache to force reload environments list'
do
expect_any_instance_of
(
Gitlab
::
EtagCaching
::
Store
)
.
to
receive
(
:touch
).
with
(
project_environments_path
(
project
,
format: :json
))
get
:index
,
environment_params
end
end
end
context
'when requesting JSON response for folders'
do
context
'when requesting JSON response for folders'
do
...
...
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