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
d02322e8
Commit
d02322e8
authored
Mar 09, 2022
by
huzaifaiftikhar1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add RSpecs for deploy_tokens_controller.rb
parent
2d354e32
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
spec/requests/groups/deploy_tokens_controller_spec.rb
spec/requests/groups/deploy_tokens_controller_spec.rb
+40
-0
No files found.
spec/requests/groups/deploy_tokens_controller_spec.rb
0 → 100644
View file @
d02322e8
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Groups
::
DeployTokensController
do
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:deploy_token
)
{
create
(
:deploy_token
,
:group
,
groups:
[
group
])
}
let_it_be
(
:params
)
do
{
id:
deploy_token
.
id
,
group_id:
group
}
end
before
do
group
.
add_owner
(
user
)
sign_in
(
user
)
end
describe
'PUT /groups/:group_path_with_namespace/-/deploy_tokens/:id/revoke'
do
subject
(
:put_revoke
)
do
put
"/groups/
#{
group
.
full_path
}
/-/deploy_tokens/
#{
deploy_token
.
id
}
/revoke"
,
params:
params
end
it
'invokes the Groups::DeployTokens::RevokeService'
do
expect
(
deploy_token
.
revoked
).
to
eq
(
false
)
expect
(
Groups
::
DeployTokens
::
RevokeService
).
to
receive
(
:new
).
and_call_original
put_revoke
expect
(
deploy_token
.
reload
.
revoked
).
to
eq
(
true
)
end
it
'redirects to group repository settings with correct anchor'
do
put_revoke
expect
(
response
).
to
have_gitlab_http_status
(
:redirect
)
expect
(
response
).
to
redirect_to
(
group_settings_repository_path
(
group
,
anchor:
'js-deploy-tokens'
))
end
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