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
64a099f3
Commit
64a099f3
authored
Jan 31, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add http status cop to all project controller spec
347 files inspected, 95 offenses detected, 95 offenses corrected
parent
86331c07
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
97 additions
and
97 deletions
+97
-97
.rubocop.yml
.rubocop.yml
+2
-2
ee/spec/controllers/projects/merge_requests/drafts_controller_spec.rb
...rollers/projects/merge_requests/drafts_controller_spec.rb
+17
-17
ee/spec/controllers/projects/prometheus/metrics_controller_spec.rb
...ontrollers/projects/prometheus/metrics_controller_spec.rb
+5
-5
ee/spec/controllers/projects/security/configuration_controller_spec.rb
...ollers/projects/security/configuration_controller_spec.rb
+2
-2
ee/spec/controllers/projects/security/dashboard_controller_spec.rb
...ontrollers/projects/security/dashboard_controller_spec.rb
+5
-5
ee/spec/controllers/projects/security/waf_anomalies_controller_spec.rb
...ollers/projects/security/waf_anomalies_controller_spec.rb
+3
-3
ee/spec/controllers/projects/settings/operations_controller_spec.rb
...ntrollers/projects/settings/operations_controller_spec.rb
+1
-1
ee/spec/controllers/projects/settings/slacks_controller_spec.rb
...c/controllers/projects/settings/slacks_controller_spec.rb
+3
-3
spec/controllers/projects/ci/lints_controller_spec.rb
spec/controllers/projects/ci/lints_controller_spec.rb
+2
-2
spec/controllers/projects/clusters/applications_controller_spec.rb
...rollers/projects/clusters/applications_controller_spec.rb
+12
-12
spec/controllers/projects/merge_requests/content_controller_spec.rb
...ollers/projects/merge_requests/content_controller_spec.rb
+2
-2
spec/controllers/projects/merge_requests/creations_controller_spec.rb
...lers/projects/merge_requests/creations_controller_spec.rb
+5
-5
spec/controllers/projects/merge_requests/diffs_controller_spec.rb
...trollers/projects/merge_requests/diffs_controller_spec.rb
+13
-13
spec/controllers/projects/prometheus/metrics_controller_spec.rb
...ontrollers/projects/prometheus/metrics_controller_spec.rb
+5
-5
spec/controllers/projects/serverless/functions_controller_spec.rb
...trollers/projects/serverless/functions_controller_spec.rb
+8
-8
spec/controllers/projects/settings/ci_cd_controller_spec.rb
spec/controllers/projects/settings/ci_cd_controller_spec.rb
+2
-2
spec/controllers/projects/settings/integrations_controller_spec.rb
...rollers/projects/settings/integrations_controller_spec.rb
+1
-1
spec/controllers/projects/settings/repository_controller_spec.rb
...ntrollers/projects/settings/repository_controller_spec.rb
+2
-2
spec/controllers/projects/tags/releases_controller_spec.rb
spec/controllers/projects/tags/releases_controller_spec.rb
+7
-7
No files found.
.rubocop.yml
View file @
64a099f3
...
@@ -341,8 +341,8 @@ RSpec/HaveGitlabHttpStatus:
...
@@ -341,8 +341,8 @@ RSpec/HaveGitlabHttpStatus:
-
'
ee/spec/features/**/*'
-
'
ee/spec/features/**/*'
-
'
spec/controllers/*.rb'
-
'
spec/controllers/*.rb'
-
'
ee/spec/controllers/*.rb'
-
'
ee/spec/controllers/*.rb'
-
'
spec/controllers/projects/*.rb'
-
'
spec/controllers/projects/*
*/*
.rb'
-
'
ee/spec/controllers/projects/*.rb'
-
'
ee/spec/controllers/projects/*
*/*
.rb'
-
'
spec/requests/*.rb'
-
'
spec/requests/*.rb'
-
'
ee/spec/requests/*.rb'
-
'
ee/spec/requests/*.rb'
...
...
ee/spec/controllers/projects/merge_requests/drafts_controller_spec.rb
View file @
64a099f3
...
@@ -55,7 +55,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -55,7 +55,7 @@ describe Projects::MergeRequests::DraftsController do
it
'does not allow draft note creation'
do
it
'does not allow draft note creation'
do
expect
{
create_draft_note
}.
to
change
{
DraftNote
.
count
}.
by
(
0
)
expect
{
create_draft_note
}.
to
change
{
DraftNote
.
count
}.
by
(
0
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -76,7 +76,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -76,7 +76,7 @@ describe Projects::MergeRequests::DraftsController do
create_draft_note
(
draft_overrides:
{
position:
position
.
to_json
})
create_draft_note
(
draft_overrides:
{
position:
position
.
to_json
})
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'position'
]).
to
be_present
expect
(
json_response
[
'position'
]).
to
be_present
expect
(
json_response
[
'file_hash'
]).
to
be_present
expect
(
json_response
[
'file_hash'
]).
to
be_present
expect
(
json_response
[
'line_code'
]).
to
match
(
/\w+_\d+_\d+/
)
expect
(
json_response
[
'line_code'
]).
to
match
(
/\w+_\d+_\d+/
)
...
@@ -86,7 +86,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -86,7 +86,7 @@ describe Projects::MergeRequests::DraftsController do
it
'creates a draft note with quick actions'
do
it
'creates a draft note with quick actions'
do
create_draft_note
(
draft_overrides:
{
note:
"
#{
user2
.
to_reference
}
\n
/assign
#{
user
.
to_reference
}
"
})
create_draft_note
(
draft_overrides:
{
note:
"
#{
user2
.
to_reference
}
\n
/assign
#{
user
.
to_reference
}
"
})
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'note_html'
]).
to
match
(
/
#{
user2
.
to_reference
}
/
)
expect
(
json_response
[
'note_html'
]).
to
match
(
/
#{
user2
.
to_reference
}
/
)
expect
(
json_response
[
'references'
][
'commands'
]).
to
match
(
/Assigns/
)
expect
(
json_response
[
'references'
][
'commands'
]).
to
match
(
/Assigns/
)
expect
(
json_response
[
'references'
][
'users'
]).
to
include
(
user2
.
username
)
expect
(
json_response
[
'references'
][
'users'
]).
to
include
(
user2
.
username
)
...
@@ -196,7 +196,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -196,7 +196,7 @@ describe Projects::MergeRequests::DraftsController do
it
'does not allow editing draft note belonging to someone else'
do
it
'does not allow editing draft note belonging to someone else'
do
update_draft_note
update_draft_note
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
draft
.
reload
.
note
).
not_to
eq
(
'This is an updated unpublished comment'
)
expect
(
draft
.
reload
.
note
).
not_to
eq
(
'This is an updated unpublished comment'
)
end
end
end
end
...
@@ -221,7 +221,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -221,7 +221,7 @@ describe Projects::MergeRequests::DraftsController do
.
to
not_change
{
Note
.
count
}
.
to
not_change
{
Note
.
count
}
.
and
not_change
{
DraftNote
.
count
}
.
and
not_change
{
DraftNote
.
count
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -306,7 +306,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -306,7 +306,7 @@ describe Projects::MergeRequests::DraftsController do
expect
{
post
:publish
,
params:
params
}.
to
change
{
Note
.
count
}.
by
(
1
)
expect
{
post
:publish
,
params:
params
}.
to
change
{
Note
.
count
}.
by
(
1
)
.
and
change
{
DraftNote
.
count
}.
by
(
-
1
)
.
and
change
{
DraftNote
.
count
}.
by
(
-
1
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
merge_request
.
reload
.
assignee_ids
).
to
match_array
([
user
.
id
,
user2
.
id
])
expect
(
merge_request
.
reload
.
assignee_ids
).
to
match_array
([
user
.
id
,
user2
.
id
])
expect
(
Note
.
last
.
system?
).
to
be
true
expect
(
Note
.
last
.
system?
).
to
be
true
end
end
...
@@ -325,7 +325,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -325,7 +325,7 @@ describe Projects::MergeRequests::DraftsController do
expect
{
post
:publish
,
params:
params
}.
to
change
{
Note
.
count
}.
by
(
6
)
expect
{
post
:publish
,
params:
params
}.
to
change
{
Note
.
count
}.
by
(
6
)
.
and
change
{
DraftNote
.
count
}.
by
(
-
6
)
.
and
change
{
DraftNote
.
count
}.
by
(
-
6
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
notes
=
merge_request
.
notes
.
reload
notes
=
merge_request
.
notes
.
reload
...
@@ -402,7 +402,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -402,7 +402,7 @@ describe Projects::MergeRequests::DraftsController do
expect
{
post
:destroy
,
params:
params
.
merge
(
id:
draft
.
id
)
}
expect
{
post
:destroy
,
params:
params
.
merge
(
id:
draft
.
id
)
}
.
not_to
change
{
DraftNote
.
count
}
.
not_to
change
{
DraftNote
.
count
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -410,7 +410,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -410,7 +410,7 @@ describe Projects::MergeRequests::DraftsController do
draft
=
create_draft
draft
=
create_draft
expect
{
delete
:destroy
,
params:
params
.
merge
(
id:
draft
.
id
)
}.
to
change
{
DraftNote
.
count
}.
by
(
-
1
)
expect
{
delete
:destroy
,
params:
params
.
merge
(
id:
draft
.
id
)
}.
to
change
{
DraftNote
.
count
}.
by
(
-
1
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
context
'without permissions'
do
context
'without permissions'
do
...
@@ -422,7 +422,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -422,7 +422,7 @@ describe Projects::MergeRequests::DraftsController do
draft
=
create_draft
draft
=
create_draft
expect
{
delete
:destroy
,
params:
params
.
merge
(
id:
draft
.
id
)
}.
to
change
{
DraftNote
.
count
}.
by
(
0
)
expect
{
delete
:destroy
,
params:
params
.
merge
(
id:
draft
.
id
)
}.
to
change
{
DraftNote
.
count
}.
by
(
0
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -432,7 +432,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -432,7 +432,7 @@ describe Projects::MergeRequests::DraftsController do
create_list
(
:draft_note
,
6
,
merge_request:
merge_request
,
author:
user
)
create_list
(
:draft_note
,
6
,
merge_request:
merge_request
,
author:
user
)
expect
{
delete
:discard
,
params:
params
}.
to
change
{
DraftNote
.
count
}.
by
(
-
6
)
expect
{
delete
:discard
,
params:
params
}.
to
change
{
DraftNote
.
count
}.
by
(
-
6
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
context
'without permissions'
do
context
'without permissions'
do
...
@@ -447,7 +447,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -447,7 +447,7 @@ describe Projects::MergeRequests::DraftsController do
expect
{
post
:discard
,
params:
params
}
expect
{
post
:discard
,
params:
params
}
.
not_to
change
{
DraftNote
.
count
}
.
not_to
change
{
DraftNote
.
count
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
end
end
...
@@ -469,7 +469,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -469,7 +469,7 @@ describe Projects::MergeRequests::DraftsController do
post
:create
,
params:
params
.
merge
(
draft_note:
{
note:
'comment'
})
post
:create
,
params:
params
.
merge
(
draft_note:
{
note:
'comment'
})
end
.
to
change
{
DraftNote
.
count
}.
by
(
0
)
end
.
to
change
{
DraftNote
.
count
}.
by
(
0
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
end
end
...
@@ -481,7 +481,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -481,7 +481,7 @@ describe Projects::MergeRequests::DraftsController do
put
:update
,
params:
params
.
merge
(
id:
draft
.
id
,
draft_note:
{
note:
'comment'
})
put
:update
,
params:
params
.
merge
(
id:
draft
.
id
,
draft_note:
{
note:
'comment'
})
end
.
to
change
{
DraftNote
.
count
}.
by
(
0
)
end
.
to
change
{
DraftNote
.
count
}.
by
(
0
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
end
end
...
@@ -490,7 +490,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -490,7 +490,7 @@ describe Projects::MergeRequests::DraftsController do
draft
=
create
(
:draft_note
,
merge_request:
merge_request
,
author:
user
)
draft
=
create
(
:draft_note
,
merge_request:
merge_request
,
author:
user
)
expect
{
delete
:destroy
,
params:
params
.
merge
(
id:
draft
.
id
)
}.
to
change
{
DraftNote
.
count
}.
by
(
0
)
expect
{
delete
:destroy
,
params:
params
.
merge
(
id:
draft
.
id
)
}.
to
change
{
DraftNote
.
count
}.
by
(
0
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
end
end
...
@@ -505,7 +505,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -505,7 +505,7 @@ describe Projects::MergeRequests::DraftsController do
post
:publish
,
params:
params
post
:publish
,
params:
params
end
.
to
change
{
DraftNote
.
count
}.
by
(
0
).
and
change
{
Note
.
count
}.
by
(
0
)
end
.
to
change
{
DraftNote
.
count
}.
by
(
0
).
and
change
{
Note
.
count
}.
by
(
0
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
DraftNote
.
count
).
to
eq
(
5
)
expect
(
DraftNote
.
count
).
to
eq
(
5
)
end
end
end
end
...
@@ -516,7 +516,7 @@ describe Projects::MergeRequests::DraftsController do
...
@@ -516,7 +516,7 @@ describe Projects::MergeRequests::DraftsController do
delete
:discard
,
params:
params
delete
:discard
,
params:
params
end
.
to
change
{
DraftNote
.
count
}.
by
(
0
)
end
.
to
change
{
DraftNote
.
count
}.
by
(
0
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
DraftNote
.
count
).
to
eq
(
5
)
expect
(
DraftNote
.
count
).
to
eq
(
5
)
end
end
end
end
...
...
ee/spec/controllers/projects/prometheus/metrics_controller_spec.rb
View file @
64a099f3
...
@@ -53,7 +53,7 @@ describe Projects::Prometheus::MetricsController do
...
@@ -53,7 +53,7 @@ describe Projects::Prometheus::MetricsController do
it
'validation data is returned'
do
it
'validation data is returned'
do
post
:validate_query
,
params:
project_params
(
format: :json
,
query:
query
)
post
:validate_query
,
params:
project_params
(
format: :json
,
query:
query
)
expect
(
response
).
to
have_gitlab_http_status
(
202
)
expect
(
response
).
to
have_gitlab_http_status
(
:accepted
)
end
end
end
end
...
@@ -77,7 +77,7 @@ describe Projects::Prometheus::MetricsController do
...
@@ -77,7 +77,7 @@ describe Projects::Prometheus::MetricsController do
it
'returns a list of metrics'
do
it
'returns a list of metrics'
do
get
:index
,
params:
project_params
(
format: :json
)
get
:index
,
params:
project_params
(
format: :json
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'prometheus/metrics'
,
dir:
'ee'
)
expect
(
response
).
to
match_response_schema
(
'prometheus/metrics'
,
dir:
'ee'
)
end
end
end
end
...
@@ -86,7 +86,7 @@ describe Projects::Prometheus::MetricsController do
...
@@ -86,7 +86,7 @@ describe Projects::Prometheus::MetricsController do
it
'returns an empty json'
do
it
'returns an empty json'
do
get
:index
,
params:
project_params
(
format: :json
)
get
:index
,
params:
project_params
(
format: :json
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
({})
expect
(
json_response
).
to
eq
({})
end
end
end
end
...
@@ -119,7 +119,7 @@ describe Projects::Prometheus::MetricsController do
...
@@ -119,7 +119,7 @@ describe Projects::Prometheus::MetricsController do
it
'renders new metric page'
do
it
'renders new metric page'
do
post
:create
,
params:
project_params
(
invalid_metric
)
post
:create
,
params:
project_params
(
invalid_metric
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
'new'
)
expect
(
response
).
to
render_template
(
'new'
)
end
end
end
end
...
@@ -151,7 +151,7 @@ describe Projects::Prometheus::MetricsController do
...
@@ -151,7 +151,7 @@ describe Projects::Prometheus::MetricsController do
it
'destroys the metric'
do
it
'destroys the metric'
do
delete
:destroy
,
params:
project_params
(
id:
metric
.
id
,
format: :json
)
delete
:destroy
,
params:
project_params
(
id:
metric
.
id
,
format: :json
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
PrometheusMetric
.
find_by
(
id:
metric
.
id
)).
to
be_nil
expect
(
PrometheusMetric
.
find_by
(
id:
metric
.
id
)).
to
be_nil
end
end
end
end
...
...
ee/spec/controllers/projects/security/configuration_controller_spec.rb
View file @
64a099f3
...
@@ -31,7 +31,7 @@ describe Projects::Security::ConfigurationController do
...
@@ -31,7 +31,7 @@ describe Projects::Security::ConfigurationController do
it
"renders data on the project's security configuration"
do
it
"renders data on the project's security configuration"
do
subject
subject
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
.
body
).
to
have_css
(
expect
(
response
.
body
).
to
have_css
(
'div#js-security-configuration'
\
'div#js-security-configuration'
\
...
@@ -55,7 +55,7 @@ describe Projects::Security::ConfigurationController do
...
@@ -55,7 +55,7 @@ describe Projects::Security::ConfigurationController do
it
'reports that Auto DevOps is enabled'
do
it
'reports that Auto DevOps is enabled'
do
subject
subject
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
.
body
).
to
have_css
(
expect
(
response
.
body
).
to
have_css
(
'div#js-security-configuration'
\
'div#js-security-configuration'
\
'[data-auto-devops-enabled]'
\
'[data-auto-devops-enabled]'
\
...
...
ee/spec/controllers/projects/security/dashboard_controller_spec.rb
View file @
64a099f3
...
@@ -38,7 +38,7 @@ describe Projects::Security::DashboardController do
...
@@ -38,7 +38,7 @@ describe Projects::Security::DashboardController do
it
'returns the latest pipeline with security reports for project'
do
it
'returns the latest pipeline with security reports for project'
do
show_security_dashboard
show_security_dashboard
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:index
)
expect
(
response
).
to
render_template
(
:index
)
expect
(
response
.
body
).
to
have_css
(
"div#js-security-report-app[data-has-pipeline-data=true]"
)
expect
(
response
.
body
).
to
have_css
(
"div#js-security-report-app[data-has-pipeline-data=true]"
)
end
end
...
@@ -52,7 +52,7 @@ describe Projects::Security::DashboardController do
...
@@ -52,7 +52,7 @@ describe Projects::Security::DashboardController do
it
'returns the latest pipeline with security reports for project'
do
it
'returns the latest pipeline with security reports for project'
do
show_security_dashboard
show_security_dashboard
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:index
)
expect
(
response
).
to
render_template
(
:index
)
expect
(
response
.
body
).
to
have_css
(
"div#js-security-report-app[data-has-pipeline-data=true]"
)
expect
(
response
.
body
).
to
have_css
(
"div#js-security-report-app[data-has-pipeline-data=true]"
)
end
end
...
@@ -62,7 +62,7 @@ describe Projects::Security::DashboardController do
...
@@ -62,7 +62,7 @@ describe Projects::Security::DashboardController do
it
'renders empty state'
do
it
'renders empty state'
do
show_security_dashboard
show_security_dashboard
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:index
)
expect
(
response
).
to
render_template
(
:index
)
expect
(
response
.
body
).
to
have_css
(
"div#js-security-report-app[data-has-pipeline-data=false]"
)
expect
(
response
.
body
).
to
have_css
(
"div#js-security-report-app[data-has-pipeline-data=false]"
)
end
end
...
@@ -86,7 +86,7 @@ describe Projects::Security::DashboardController do
...
@@ -86,7 +86,7 @@ describe Projects::Security::DashboardController do
it
'renders the vulnerability page'
do
it
'renders the vulnerability page'
do
show_vulnerability
show_vulnerability
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
.
body
).
to
have_text
(
vulnerability
.
title
)
expect
(
response
.
body
).
to
have_text
(
vulnerability
.
title
)
end
end
...
@@ -116,7 +116,7 @@ describe Projects::Security::DashboardController do
...
@@ -116,7 +116,7 @@ describe Projects::Security::DashboardController do
it
'renders the 404 page'
do
it
'renders the 404 page'
do
show_vulnerability
show_vulnerability
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
...
ee/spec/controllers/projects/security/waf_anomalies_controller_spec.rb
View file @
64a099f3
...
@@ -41,7 +41,7 @@ describe Projects::Security::WafAnomaliesController do
...
@@ -41,7 +41,7 @@ describe Projects::Security::WafAnomaliesController do
it
'returns anomaly summary'
do
it
'returns anomaly summary'
do
subject
subject
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'total_traffic'
]).
to
eq
(
0
)
expect
(
json_response
[
'total_traffic'
]).
to
eq
(
0
)
expect
(
json_response
[
'anomalous_traffic'
]).
to
eq
(
0
)
expect
(
json_response
[
'anomalous_traffic'
]).
to
eq
(
0
)
expect
(
response
).
to
match_response_schema
(
'vulnerabilities/summary'
,
dir:
'ee'
)
expect
(
response
).
to
match_response_schema
(
'vulnerabilities/summary'
,
dir:
'ee'
)
...
@@ -52,7 +52,7 @@ describe Projects::Security::WafAnomaliesController do
...
@@ -52,7 +52,7 @@ describe Projects::Security::WafAnomaliesController do
it
'returns not found'
do
it
'returns not found'
do
subject
subject
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -67,7 +67,7 @@ describe Projects::Security::WafAnomaliesController do
...
@@ -67,7 +67,7 @@ describe Projects::Security::WafAnomaliesController do
it
'returns unauthorized'
do
it
'returns unauthorized'
do
subject
subject
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
end
end
end
end
...
...
ee/spec/controllers/projects/settings/operations_controller_spec.rb
View file @
64a099f3
...
@@ -34,7 +34,7 @@ describe Projects::Settings::OperationsController do
...
@@ -34,7 +34,7 @@ describe Projects::Settings::OperationsController do
it
'renders ok'
do
it
'renders ok'
do
get
:show
,
params:
project_params
(
project
)
get
:show
,
params:
project_params
(
project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
).
to
render_template
(
:show
)
end
end
end
end
...
...
ee/spec/controllers/projects/settings/slacks_controller_spec.rb
View file @
64a099f3
...
@@ -36,7 +36,7 @@ describe Projects::Settings::SlacksController do
...
@@ -36,7 +36,7 @@ describe Projects::Settings::SlacksController do
get
:slack_auth
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
get
:slack_auth
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
redirect_to
(
redirect_url
(
project
))
expect
(
response
).
to
redirect_to
(
redirect_url
(
project
))
expect
(
flash
[
:alert
]).
to
be_nil
expect
(
flash
[
:alert
]).
to
be_nil
end
end
...
@@ -46,7 +46,7 @@ describe Projects::Settings::SlacksController do
...
@@ -46,7 +46,7 @@ describe Projects::Settings::SlacksController do
get
:slack_auth
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
get
:slack_auth
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
redirect_to
(
redirect_url
(
project
))
expect
(
response
).
to
redirect_to
(
redirect_url
(
project
))
expect
(
flash
[
:alert
]).
to
eq
(
'error'
)
expect
(
flash
[
:alert
]).
to
eq
(
'error'
)
end
end
...
@@ -56,7 +56,7 @@ describe Projects::Settings::SlacksController do
...
@@ -56,7 +56,7 @@ describe Projects::Settings::SlacksController do
it
'returns 403'
do
it
'returns 403'
do
get
:slack_auth
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
get
:slack_auth
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
end
end
end
end
...
...
spec/controllers/projects/ci/lints_controller_spec.rb
View file @
64a099f3
...
@@ -39,7 +39,7 @@ describe Projects::Ci::LintsController do
...
@@ -39,7 +39,7 @@ describe Projects::Ci::LintsController do
end
end
it
'responds with 404'
do
it
'responds with 404'
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -115,7 +115,7 @@ describe Projects::Ci::LintsController do
...
@@ -115,7 +115,7 @@ describe Projects::Ci::LintsController do
end
end
it
'responds with 404'
do
it
'responds with 404'
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
...
spec/controllers/projects/clusters/applications_controller_spec.rb
View file @
64a099f3
...
@@ -42,7 +42,7 @@ describe Projects::Clusters::ApplicationsController do
...
@@ -42,7 +42,7 @@ describe Projects::Clusters::ApplicationsController do
expect
(
ClusterInstallAppWorker
).
to
receive
(
:perform_async
).
with
(
application
,
anything
).
once
expect
(
ClusterInstallAppWorker
).
to
receive
(
:perform_async
).
with
(
application
,
anything
).
once
expect
{
subject
}.
to
change
{
current_application
.
count
}
expect
{
subject
}.
to
change
{
current_application
.
count
}
expect
(
response
).
to
have_http_status
(
:no_content
)
expect
(
response
).
to
have_
gitlab_
http_status
(
:no_content
)
expect
(
cluster
.
application_helm
).
to
be_scheduled
expect
(
cluster
.
application_helm
).
to
be_scheduled
end
end
...
@@ -53,7 +53,7 @@ describe Projects::Clusters::ApplicationsController do
...
@@ -53,7 +53,7 @@ describe Projects::Clusters::ApplicationsController do
it
'return 404'
do
it
'return 404'
do
expect
{
subject
}.
not_to
change
{
current_application
.
count
}
expect
{
subject
}.
not_to
change
{
current_application
.
count
}
expect
(
response
).
to
have_http_status
(
:not_found
)
expect
(
response
).
to
have_
gitlab_
http_status
(
:not_found
)
end
end
end
end
...
@@ -61,7 +61,7 @@ describe Projects::Clusters::ApplicationsController do
...
@@ -61,7 +61,7 @@ describe Projects::Clusters::ApplicationsController do
let
(
:application
)
{
'unkwnown-app'
}
let
(
:application
)
{
'unkwnown-app'
}
it
'return 404'
do
it
'return 404'
do
is_expected
.
to
have_http_status
(
:not_found
)
is_expected
.
to
have_
gitlab_
http_status
(
:not_found
)
end
end
end
end
...
@@ -71,7 +71,7 @@ describe Projects::Clusters::ApplicationsController do
...
@@ -71,7 +71,7 @@ describe Projects::Clusters::ApplicationsController do
end
end
it
'returns 400'
do
it
'returns 400'
do
is_expected
.
to
have_http_status
(
:bad_request
)
is_expected
.
to
have_
gitlab_
http_status
(
:bad_request
)
end
end
end
end
end
end
...
@@ -108,7 +108,7 @@ describe Projects::Clusters::ApplicationsController do
...
@@ -108,7 +108,7 @@ describe Projects::Clusters::ApplicationsController do
it
"schedules an application update"
do
it
"schedules an application update"
do
expect
(
ClusterPatchAppWorker
).
to
receive
(
:perform_async
).
with
(
application
.
name
,
anything
).
once
expect
(
ClusterPatchAppWorker
).
to
receive
(
:perform_async
).
with
(
application
.
name
,
anything
).
once
is_expected
.
to
have_http_status
(
:no_content
)
is_expected
.
to
have_
gitlab_
http_status
(
:no_content
)
expect
(
cluster
.
application_knative
).
to
be_scheduled
expect
(
cluster
.
application_knative
).
to
be_scheduled
end
end
...
@@ -119,13 +119,13 @@ describe Projects::Clusters::ApplicationsController do
...
@@ -119,13 +119,13 @@ describe Projects::Clusters::ApplicationsController do
cluster
.
destroy!
cluster
.
destroy!
end
end
it
{
is_expected
.
to
have_http_status
(
:not_found
)
}
it
{
is_expected
.
to
have_
gitlab_
http_status
(
:not_found
)
}
end
end
context
'when application is unknown'
do
context
'when application is unknown'
do
let
(
:application_name
)
{
'unkwnown-app'
}
let
(
:application_name
)
{
'unkwnown-app'
}
it
{
is_expected
.
to
have_http_status
(
:not_found
)
}
it
{
is_expected
.
to
have_
gitlab_
http_status
(
:not_found
)
}
end
end
context
'when application is already scheduled'
do
context
'when application is already scheduled'
do
...
@@ -133,7 +133,7 @@ describe Projects::Clusters::ApplicationsController do
...
@@ -133,7 +133,7 @@ describe Projects::Clusters::ApplicationsController do
application
.
make_scheduled!
application
.
make_scheduled!
end
end
it
{
is_expected
.
to
have_http_status
(
:bad_request
)
}
it
{
is_expected
.
to
have_
gitlab_
http_status
(
:bad_request
)
}
end
end
end
end
...
@@ -170,7 +170,7 @@ describe Projects::Clusters::ApplicationsController do
...
@@ -170,7 +170,7 @@ describe Projects::Clusters::ApplicationsController do
it
"schedules an application update"
do
it
"schedules an application update"
do
expect
(
worker_class
).
to
receive
(
:perform_async
).
with
(
application
.
name
,
application
.
id
).
once
expect
(
worker_class
).
to
receive
(
:perform_async
).
with
(
application
.
name
,
application
.
id
).
once
is_expected
.
to
have_http_status
(
:no_content
)
is_expected
.
to
have_
gitlab_
http_status
(
:no_content
)
expect
(
cluster
.
application_prometheus
).
to
be_scheduled
expect
(
cluster
.
application_prometheus
).
to
be_scheduled
end
end
...
@@ -181,13 +181,13 @@ describe Projects::Clusters::ApplicationsController do
...
@@ -181,13 +181,13 @@ describe Projects::Clusters::ApplicationsController do
cluster
.
destroy!
cluster
.
destroy!
end
end
it
{
is_expected
.
to
have_http_status
(
:not_found
)
}
it
{
is_expected
.
to
have_
gitlab_
http_status
(
:not_found
)
}
end
end
context
'when application is unknown'
do
context
'when application is unknown'
do
let
(
:application_name
)
{
'unkwnown-app'
}
let
(
:application_name
)
{
'unkwnown-app'
}
it
{
is_expected
.
to
have_http_status
(
:not_found
)
}
it
{
is_expected
.
to
have_
gitlab_
http_status
(
:not_found
)
}
end
end
context
'when application is already scheduled'
do
context
'when application is already scheduled'
do
...
@@ -195,7 +195,7 @@ describe Projects::Clusters::ApplicationsController do
...
@@ -195,7 +195,7 @@ describe Projects::Clusters::ApplicationsController do
application
.
make_scheduled!
application
.
make_scheduled!
end
end
it
{
is_expected
.
to
have_http_status
(
:bad_request
)
}
it
{
is_expected
.
to
have_
gitlab_
http_status
(
:bad_request
)
}
end
end
end
end
...
...
spec/controllers/projects/merge_requests/content_controller_spec.rb
View file @
64a099f3
...
@@ -69,7 +69,7 @@ describe Projects::MergeRequests::ContentController do
...
@@ -69,7 +69,7 @@ describe Projects::MergeRequests::ContentController do
it
'returns 404'
do
it
'returns 404'
do
do_request
do_request
expect
(
response
).
to
have_http_status
(
:not_found
)
expect
(
response
).
to
have_
gitlab_
http_status
(
:not_found
)
end
end
end
end
...
@@ -77,7 +77,7 @@ describe Projects::MergeRequests::ContentController do
...
@@ -77,7 +77,7 @@ describe Projects::MergeRequests::ContentController do
it
'returns 404'
do
it
'returns 404'
do
do_request
(
:widget
)
do_request
(
:widget
)
expect
(
response
).
to
have_http_status
(
:not_found
)
expect
(
response
).
to
have_
gitlab_
http_status
(
:not_found
)
end
end
end
end
end
end
...
...
spec/controllers/projects/merge_requests/creations_controller_spec.rb
View file @
64a099f3
...
@@ -62,7 +62,7 @@ describe Projects::MergeRequests::CreationsController do
...
@@ -62,7 +62,7 @@ describe Projects::MergeRequests::CreationsController do
expect
(
assigns
(
:commits
)).
to
be_an
Array
expect
(
assigns
(
:commits
)).
to
be_an
Array
expect
(
total
).
to
be
>
0
expect
(
total
).
to
be
>
0
expect
(
assigns
(
:hidden_commit_count
)).
to
be
>
0
expect
(
assigns
(
:hidden_commit_count
)).
to
be
>
0
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
.
body
).
to
match
%r(<span class="commits-count">2 commits</span>)
expect
(
response
.
body
).
to
match
%r(<span class="commits-count">2 commits</span>)
end
end
end
end
...
@@ -76,7 +76,7 @@ describe Projects::MergeRequests::CreationsController do
...
@@ -76,7 +76,7 @@ describe Projects::MergeRequests::CreationsController do
expect
(
assigns
(
:commits
)).
to
be_an
CommitCollection
expect
(
assigns
(
:commits
)).
to
be_an
CommitCollection
expect
(
total
).
to
be
>
0
expect
(
total
).
to
be
>
0
expect
(
assigns
(
:hidden_commit_count
)).
to
eq
(
0
)
expect
(
assigns
(
:hidden_commit_count
)).
to
eq
(
0
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
.
body
).
to
match
%r(<span class="commits-count">
#{
total
}
commits</span>)
expect
(
response
.
body
).
to
match
%r(<span class="commits-count">
#{
total
}
commits</span>)
end
end
end
end
...
@@ -173,7 +173,7 @@ describe Projects::MergeRequests::CreationsController do
...
@@ -173,7 +173,7 @@ describe Projects::MergeRequests::CreationsController do
end
end
it
'returns a 404'
do
it
'returns a 404'
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -196,7 +196,7 @@ describe Projects::MergeRequests::CreationsController do
...
@@ -196,7 +196,7 @@ describe Projects::MergeRequests::CreationsController do
}
}
expect
(
assigns
(
:commit
)).
not_to
be_nil
expect
(
assigns
(
:commit
)).
not_to
be_nil
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'does not load the commit when the user cannot read the project'
do
it
'does not load the commit when the user cannot read the project'
do
...
@@ -211,7 +211,7 @@ describe Projects::MergeRequests::CreationsController do
...
@@ -211,7 +211,7 @@ describe Projects::MergeRequests::CreationsController do
}
}
expect
(
assigns
(
:commit
)).
to
be_nil
expect
(
assigns
(
:commit
)).
to
be_nil
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
...
...
spec/controllers/projects/merge_requests/diffs_controller_spec.rb
View file @
64a099f3
...
@@ -13,7 +13,7 @@ describe Projects::MergeRequests::DiffsController do
...
@@ -13,7 +13,7 @@ describe Projects::MergeRequests::DiffsController do
go
(
diff_id:
unexistent_diff_id
)
go
(
diff_id:
unexistent_diff_id
)
expect
(
MergeRequestDiff
.
find_by
(
id:
unexistent_diff_id
)).
to
be_nil
expect
(
MergeRequestDiff
.
find_by
(
id:
unexistent_diff_id
)).
to
be_nil
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -76,7 +76,7 @@ describe Projects::MergeRequests::DiffsController do
...
@@ -76,7 +76,7 @@ describe Projects::MergeRequests::DiffsController do
end
end
it
'returns a 404'
do
it
'returns a 404'
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -162,7 +162,7 @@ describe Projects::MergeRequests::DiffsController do
...
@@ -162,7 +162,7 @@ describe Projects::MergeRequests::DiffsController do
it
'returns 404 when not a member'
do
it
'returns 404 when not a member'
do
go
go
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns 404 when visibility level is not enough'
do
it
'returns 404 when visibility level is not enough'
do
...
@@ -170,7 +170,7 @@ describe Projects::MergeRequests::DiffsController do
...
@@ -170,7 +170,7 @@ describe Projects::MergeRequests::DiffsController do
go
go
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -178,7 +178,7 @@ describe Projects::MergeRequests::DiffsController do
...
@@ -178,7 +178,7 @@ describe Projects::MergeRequests::DiffsController do
it
'returns success'
do
it
'returns success'
do
go
(
diff_id:
merge_request
.
merge_request_diff
.
id
)
go
(
diff_id:
merge_request
.
merge_request_diff
.
id
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'serializes diffs metadata with expected arguments'
do
it
'serializes diffs metadata with expected arguments'
do
...
@@ -207,7 +207,7 @@ describe Projects::MergeRequests::DiffsController do
...
@@ -207,7 +207,7 @@ describe Projects::MergeRequests::DiffsController do
it
'returns success'
do
it
'returns success'
do
go
go
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'serializes diffs metadata with expected arguments'
do
it
'serializes diffs metadata with expected arguments'
do
...
@@ -236,7 +236,7 @@ describe Projects::MergeRequests::DiffsController do
...
@@ -236,7 +236,7 @@ describe Projects::MergeRequests::DiffsController do
it
'returns success'
do
it
'returns success'
do
go
(
commit_id:
merge_request
.
diff_head_sha
)
go
(
commit_id:
merge_request
.
diff_head_sha
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
it
'serializes diffs metadata with expected arguments'
do
it
'serializes diffs metadata with expected arguments'
do
...
@@ -305,7 +305,7 @@ describe Projects::MergeRequests::DiffsController do
...
@@ -305,7 +305,7 @@ describe Projects::MergeRequests::DiffsController do
end
end
it
'returns a 404'
do
it
'returns a 404'
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -316,7 +316,7 @@ describe Projects::MergeRequests::DiffsController do
...
@@ -316,7 +316,7 @@ describe Projects::MergeRequests::DiffsController do
end
end
it
'returns a 404'
do
it
'returns a 404'
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -329,7 +329,7 @@ describe Projects::MergeRequests::DiffsController do
...
@@ -329,7 +329,7 @@ describe Projects::MergeRequests::DiffsController do
end
end
it
'returns a 404'
do
it
'returns a 404'
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -351,7 +351,7 @@ describe Projects::MergeRequests::DiffsController do
...
@@ -351,7 +351,7 @@ describe Projects::MergeRequests::DiffsController do
it
'returns success'
do
it
'returns success'
do
subject
subject
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
...
@@ -390,7 +390,7 @@ describe Projects::MergeRequests::DiffsController do
...
@@ -390,7 +390,7 @@ describe Projects::MergeRequests::DiffsController do
it
'returns 404'
do
it
'returns 404'
do
go
go
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -404,7 +404,7 @@ describe Projects::MergeRequests::DiffsController do
...
@@ -404,7 +404,7 @@ describe Projects::MergeRequests::DiffsController do
it
'returns 404'
do
it
'returns 404'
do
go
go
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
...
spec/controllers/projects/prometheus/metrics_controller_spec.rb
View file @
64a099f3
...
@@ -28,7 +28,7 @@ describe Projects::Prometheus::MetricsController do
...
@@ -28,7 +28,7 @@ describe Projects::Prometheus::MetricsController do
it
'returns no content response'
do
it
'returns no content response'
do
get
:active_common
,
params:
project_params
(
format: :json
)
get
:active_common
,
params:
project_params
(
format: :json
)
expect
(
response
).
to
have_gitlab_http_status
(
204
)
expect
(
response
).
to
have_gitlab_http_status
(
:no_content
)
end
end
end
end
...
@@ -42,7 +42,7 @@ describe Projects::Prometheus::MetricsController do
...
@@ -42,7 +42,7 @@ describe Projects::Prometheus::MetricsController do
it
'returns no content response'
do
it
'returns no content response'
do
get
:active_common
,
params:
project_params
(
format: :json
)
get
:active_common
,
params:
project_params
(
format: :json
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
(
sample_response
.
deep_stringify_keys
)
expect
(
json_response
).
to
eq
(
sample_response
.
deep_stringify_keys
)
end
end
end
end
...
@@ -51,7 +51,7 @@ describe Projects::Prometheus::MetricsController do
...
@@ -51,7 +51,7 @@ describe Projects::Prometheus::MetricsController do
it
'returns not found response'
do
it
'returns not found response'
do
get
:active_common
,
params:
project_params
get
:active_common
,
params:
project_params
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
@@ -66,7 +66,7 @@ describe Projects::Prometheus::MetricsController do
...
@@ -66,7 +66,7 @@ describe Projects::Prometheus::MetricsController do
get
:active_common
,
params:
project_params
(
format: :json
)
get
:active_common
,
params:
project_params
(
format: :json
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -74,7 +74,7 @@ describe Projects::Prometheus::MetricsController do
...
@@ -74,7 +74,7 @@ describe Projects::Prometheus::MetricsController do
it
'renders 404'
do
it
'renders 404'
do
get
:active_common
,
params:
project_params
(
format: :json
)
get
:active_common
,
params:
project_params
(
format: :json
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
end
end
...
...
spec/controllers/projects/serverless/functions_controller_spec.rb
View file @
64a099f3
...
@@ -51,7 +51,7 @@ describe Projects::Serverless::FunctionsController do
...
@@ -51,7 +51,7 @@ describe Projects::Serverless::FunctionsController do
expect
(
json_response
).
to
eq
expected_json
expect
(
json_response
).
to
eq
expected_json
end
end
it
{
expect
(
response
).
to
have_gitlab_http_status
(
200
)
}
it
{
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
}
end
end
context
'when cache is ready'
do
context
'when cache is ready'
do
...
@@ -83,7 +83,7 @@ describe Projects::Serverless::FunctionsController do
...
@@ -83,7 +83,7 @@ describe Projects::Serverless::FunctionsController do
expect
(
json_response
).
to
eq
expected_json
expect
(
json_response
).
to
eq
expected_json
end
end
it
{
expect
(
response
).
to
have_gitlab_http_status
(
200
)
}
it
{
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
}
end
end
context
'when functions were found'
do
context
'when functions were found'
do
...
@@ -98,7 +98,7 @@ describe Projects::Serverless::FunctionsController do
...
@@ -98,7 +98,7 @@ describe Projects::Serverless::FunctionsController do
expect
(
json_response
[
"functions"
]).
not_to
be_empty
expect
(
json_response
[
"functions"
]).
not_to
be_empty
end
end
it
{
expect
(
response
).
to
have_gitlab_http_status
(
200
)
}
it
{
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
}
end
end
end
end
end
end
...
@@ -107,7 +107,7 @@ describe Projects::Serverless::FunctionsController do
...
@@ -107,7 +107,7 @@ describe Projects::Serverless::FunctionsController do
context
'invalid data'
do
context
'invalid data'
do
it
'has a bad function name'
do
it
'has a bad function name'
do
get
:show
,
params:
params
({
format: :json
,
environment_id:
"*"
,
id:
"foo"
})
get
:show
,
params:
params
({
format: :json
,
environment_id:
"*"
,
id:
"foo"
})
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
...
@@ -115,7 +115,7 @@ describe Projects::Serverless::FunctionsController do
...
@@ -115,7 +115,7 @@ describe Projects::Serverless::FunctionsController do
shared_examples
'GET #show with valid data'
do
shared_examples
'GET #show with valid data'
do
it
'has a valid function name'
do
it
'has a valid function name'
do
get
:show
,
params:
params
({
format: :json
,
environment_id:
"*"
,
id:
cluster
.
project
.
name
})
get
:show
,
params:
params
({
format: :json
,
environment_id:
"*"
,
id:
cluster
.
project
.
name
})
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
include
(
expect
(
json_response
).
to
include
(
'name'
=>
project
.
name
,
'name'
=>
project
.
name
,
...
@@ -164,7 +164,7 @@ describe Projects::Serverless::FunctionsController do
...
@@ -164,7 +164,7 @@ describe Projects::Serverless::FunctionsController do
context
'invalid data'
do
context
'invalid data'
do
it
'has a bad function name'
do
it
'has a bad function name'
do
get
:metrics
,
params:
params
({
format: :json
,
environment_id:
"*"
,
id:
"foo"
})
get
:metrics
,
params:
params
({
format: :json
,
environment_id:
"*"
,
id:
"foo"
})
expect
(
response
).
to
have_gitlab_http_status
(
204
)
expect
(
response
).
to
have_gitlab_http_status
(
:no_content
)
end
end
end
end
end
end
...
@@ -174,7 +174,7 @@ describe Projects::Serverless::FunctionsController do
...
@@ -174,7 +174,7 @@ describe Projects::Serverless::FunctionsController do
it
'has data'
do
it
'has data'
do
get
:index
,
params:
params
({
format: :json
})
get
:index
,
params:
params
({
format: :json
})
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
match
({
expect
(
json_response
).
to
match
({
'knative_installed'
=>
'checking'
,
'knative_installed'
=>
'checking'
,
...
@@ -191,7 +191,7 @@ describe Projects::Serverless::FunctionsController do
...
@@ -191,7 +191,7 @@ describe Projects::Serverless::FunctionsController do
it
'has data in html'
do
it
'has data in html'
do
get
:index
,
params:
params
get
:index
,
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
end
...
...
spec/controllers/projects/settings/ci_cd_controller_spec.rb
View file @
64a099f3
...
@@ -16,7 +16,7 @@ describe Projects::Settings::CiCdController do
...
@@ -16,7 +16,7 @@ describe Projects::Settings::CiCdController do
it
'renders show with 200 status code'
do
it
'renders show with 200 status code'
do
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
).
to
render_template
(
:show
)
end
end
...
@@ -106,7 +106,7 @@ describe Projects::Settings::CiCdController do
...
@@ -106,7 +106,7 @@ describe Projects::Settings::CiCdController do
it
'redirects to the settings page'
do
it
'redirects to the settings page'
do
subject
subject
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
flash
[
:toast
]).
to
eq
(
"Pipelines settings for '
#{
project
.
name
}
' were successfully updated."
)
expect
(
flash
[
:toast
]).
to
eq
(
"Pipelines settings for '
#{
project
.
name
}
' were successfully updated."
)
end
end
...
...
spec/controllers/projects/settings/integrations_controller_spec.rb
View file @
64a099f3
...
@@ -15,7 +15,7 @@ describe Projects::Settings::IntegrationsController do
...
@@ -15,7 +15,7 @@ describe Projects::Settings::IntegrationsController do
it
'renders show with 200 status code'
do
it
'renders show with 200 status code'
do
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
).
to
render_template
(
:show
)
end
end
end
end
...
...
spec/controllers/projects/settings/repository_controller_spec.rb
View file @
64a099f3
...
@@ -15,7 +15,7 @@ describe Projects::Settings::RepositoryController do
...
@@ -15,7 +15,7 @@ describe Projects::Settings::RepositoryController do
it
'renders show with 200 status code'
do
it
'renders show with 200 status code'
do
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
).
to
render_template
(
:show
)
end
end
end
end
...
@@ -48,7 +48,7 @@ describe Projects::Settings::RepositoryController do
...
@@ -48,7 +48,7 @@ describe Projects::Settings::RepositoryController do
it
'creates deploy token'
do
it
'creates deploy token'
do
expect
{
create_deploy_token
}.
to
change
{
DeployToken
.
active
.
count
}.
by
(
1
)
expect
{
create_deploy_token
}.
to
change
{
DeployToken
.
active
.
count
}.
by
(
1
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
).
to
render_template
(
:show
)
end
end
end
end
...
...
spec/controllers/projects/tags/releases_controller_spec.rb
View file @
64a099f3
...
@@ -23,7 +23,7 @@ describe Projects::Tags::ReleasesController do
...
@@ -23,7 +23,7 @@ describe Projects::Tags::ReleasesController do
release
=
assigns
(
:release
)
release
=
assigns
(
:release
)
expect
(
release
).
not_to
be_nil
expect
(
release
).
not_to
be_nil
expect
(
release
).
not_to
be_persisted
expect
(
release
).
not_to
be_persisted
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
response
).
to
have_
gitlab_
http_status
(
:ok
)
end
end
it
'retrieves an existing release'
do
it
'retrieves an existing release'
do
...
@@ -32,7 +32,7 @@ describe Projects::Tags::ReleasesController do
...
@@ -32,7 +32,7 @@ describe Projects::Tags::ReleasesController do
release
=
assigns
(
:release
)
release
=
assigns
(
:release
)
expect
(
release
).
not_to
be_nil
expect
(
release
).
not_to
be_nil
expect
(
release
).
to
be_persisted
expect
(
release
).
to
be_persisted
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
response
).
to
have_
gitlab_
http_status
(
:ok
)
end
end
end
end
...
@@ -42,7 +42,7 @@ describe Projects::Tags::ReleasesController do
...
@@ -42,7 +42,7 @@ describe Projects::Tags::ReleasesController do
release
=
project
.
releases
.
find_by
(
tag:
tag
)
release
=
project
.
releases
.
find_by
(
tag:
tag
)
expect
(
release
.
description
).
to
eq
(
"description updated"
)
expect
(
release
.
description
).
to
eq
(
"description updated"
)
expect
(
response
).
to
have_http_status
(
:found
)
expect
(
response
).
to
have_
gitlab_
http_status
(
:found
)
end
end
it
'creates a release if one does not exist'
do
it
'creates a release if one does not exist'
do
...
@@ -52,7 +52,7 @@ describe Projects::Tags::ReleasesController do
...
@@ -52,7 +52,7 @@ describe Projects::Tags::ReleasesController do
update_release
(
tag_without_release
.
name
,
"a new release"
)
update_release
(
tag_without_release
.
name
,
"a new release"
)
end
.
to
change
{
project
.
releases
.
count
}.
by
(
1
)
end
.
to
change
{
project
.
releases
.
count
}.
by
(
1
)
expect
(
response
).
to
have_http_status
(
:found
)
expect
(
response
).
to
have_
gitlab_
http_status
(
:found
)
end
end
it
'sets the release name, sha, and author for a new release'
do
it
'sets the release name, sha, and author for a new release'
do
...
@@ -64,7 +64,7 @@ describe Projects::Tags::ReleasesController do
...
@@ -64,7 +64,7 @@ describe Projects::Tags::ReleasesController do
expect
(
release
.
name
).
to
eq
(
tag_without_release
.
name
)
expect
(
release
.
name
).
to
eq
(
tag_without_release
.
name
)
expect
(
release
.
sha
).
to
eq
(
tag_without_release
.
target_commit
.
sha
)
expect
(
release
.
sha
).
to
eq
(
tag_without_release
.
target_commit
.
sha
)
expect
(
release
.
author
.
id
).
to
eq
(
user
.
id
)
expect
(
release
.
author
.
id
).
to
eq
(
user
.
id
)
expect
(
response
).
to
have_http_status
(
:found
)
expect
(
response
).
to
have_
gitlab_
http_status
(
:found
)
end
end
it
'deletes release when description is empty'
do
it
'deletes release when description is empty'
do
...
@@ -74,7 +74,7 @@ describe Projects::Tags::ReleasesController do
...
@@ -74,7 +74,7 @@ describe Projects::Tags::ReleasesController do
expect
(
initial_releases_count
).
to
eq
(
1
)
expect
(
initial_releases_count
).
to
eq
(
1
)
expect
(
project
.
releases
.
count
).
to
eq
(
0
)
expect
(
project
.
releases
.
count
).
to
eq
(
0
)
expect
(
response
).
to
have_http_status
(
:found
)
expect
(
response
).
to
have_
gitlab_
http_status
(
:found
)
end
end
it
'does nothing when description is empty and the tag does not have a release'
do
it
'does nothing when description is empty and the tag does not have a release'
do
...
@@ -84,7 +84,7 @@ describe Projects::Tags::ReleasesController do
...
@@ -84,7 +84,7 @@ describe Projects::Tags::ReleasesController do
update_release
(
tag_without_release
.
name
,
""
)
update_release
(
tag_without_release
.
name
,
""
)
end
.
not_to
change
{
project
.
releases
.
count
}
end
.
not_to
change
{
project
.
releases
.
count
}
expect
(
response
).
to
have_http_status
(
:found
)
expect
(
response
).
to
have_
gitlab_
http_status
(
:found
)
end
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