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
57afac6a
Commit
57afac6a
authored
Jan 25, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add http status cop in top-level controller specs
347 files inspected, 207 offenses detected, 207 offenses corrected
parent
ebb80e40
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
210 additions
and
207 deletions
+210
-207
.rubocop.yml
.rubocop.yml
+3
-0
ee/spec/controllers/groups_controller_spec.rb
ee/spec/controllers/groups_controller_spec.rb
+1
-1
ee/spec/controllers/operations_controller_spec.rb
ee/spec/controllers/operations_controller_spec.rb
+14
-14
ee/spec/controllers/projects_controller_spec.rb
ee/spec/controllers/projects_controller_spec.rb
+12
-12
spec/controllers/acme_challenges_controller_spec.rb
spec/controllers/acme_challenges_controller_spec.rb
+2
-2
spec/controllers/application_controller_spec.rb
spec/controllers/application_controller_spec.rb
+9
-9
spec/controllers/autocomplete_controller_spec.rb
spec/controllers/autocomplete_controller_spec.rb
+10
-10
spec/controllers/chaos_controller_spec.rb
spec/controllers/chaos_controller_spec.rb
+14
-14
spec/controllers/graphql_controller_spec.rb
spec/controllers/graphql_controller_spec.rb
+2
-2
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+22
-22
spec/controllers/health_check_controller_spec.rb
spec/controllers/health_check_controller_spec.rb
+4
-4
spec/controllers/help_controller_spec.rb
spec/controllers/help_controller_spec.rb
+1
-1
spec/controllers/invites_controller_spec.rb
spec/controllers/invites_controller_spec.rb
+2
-2
spec/controllers/notification_settings_controller_spec.rb
spec/controllers/notification_settings_controller_spec.rb
+2
-2
spec/controllers/omniauth_callbacks_controller_spec.rb
spec/controllers/omniauth_callbacks_controller_spec.rb
+1
-1
spec/controllers/passwords_controller_spec.rb
spec/controllers/passwords_controller_spec.rb
+1
-1
spec/controllers/profiles_controller_spec.rb
spec/controllers/profiles_controller_spec.rb
+1
-1
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+42
-42
spec/controllers/registrations_controller_spec.rb
spec/controllers/registrations_controller_spec.rb
+3
-3
spec/controllers/search_controller_spec.rb
spec/controllers/search_controller_spec.rb
+6
-6
spec/controllers/sessions_controller_spec.rb
spec/controllers/sessions_controller_spec.rb
+2
-2
spec/controllers/snippets_controller_spec.rb
spec/controllers/snippets_controller_spec.rb
+20
-20
spec/controllers/uploads_controller_spec.rb
spec/controllers/uploads_controller_spec.rb
+30
-30
spec/controllers/users_controller_spec.rb
spec/controllers/users_controller_spec.rb
+6
-6
No files found.
.rubocop.yml
View file @
57afac6a
...
...
@@ -343,6 +343,7 @@ RSpec/MissingExampleGroupArgument:
RSpec/UnspecifiedException
:
Enabled
:
false
# Work in progress. See https://gitlab.com/gitlab-org/gitlab/issues/196163
RSpec/HaveGitlabHttpStatus
:
Enabled
:
true
Include
:
...
...
@@ -350,6 +351,8 @@ RSpec/HaveGitlabHttpStatus:
-
'
ee/spec/support/shared_examples/**/*'
-
'
spec/features/**/*'
-
'
ee/spec/features/**/*'
-
'
spec/controllers/*.rb'
-
'
ee/spec/controllers/*.rb'
Style/MultilineWhenThen
:
Enabled
:
false
...
...
ee/spec/controllers/groups_controller_spec.rb
View file @
57afac6a
...
...
@@ -16,7 +16,7 @@ describe GroupsController do
post
:create
,
params:
{
group:
{
name:
'new_group'
,
path:
"new_group"
}
}
end
.
to
change
{
Group
.
count
}.
by
(
1
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
end
end
...
...
ee/spec/controllers/operations_controller_spec.rb
View file @
57afac6a
...
...
@@ -33,7 +33,7 @@ describe OperationsController do
it
'renders index with 200 status code'
do
get
:index
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:index
)
end
...
...
@@ -42,7 +42,7 @@ describe OperationsController do
get
:index
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:index
)
end
...
...
@@ -113,7 +113,7 @@ describe OperationsController do
it
'returns an empty list'
do
get
:list
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
match_schema
(
'dashboard/operations/list'
,
dir:
'ee'
)
expect
(
json_response
[
'projects'
]).
to
eq
([])
end
...
...
@@ -154,7 +154,7 @@ describe OperationsController do
it
'returns a list of added projects'
do
get
:list
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'dashboard/operations/list'
,
dir:
'ee'
)
expect
(
json_response
[
'projects'
].
size
).
to
eq
(
1
)
...
...
@@ -178,7 +178,7 @@ describe OperationsController do
get
:list
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'dashboard/operations/list'
,
dir:
'ee'
)
expect
(
json_response
[
'projects'
].
size
).
to
eq
(
8
)
...
...
@@ -189,7 +189,7 @@ describe OperationsController do
get
:list
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'dashboard/operations/list'
,
dir:
'ee'
)
expect
(
json_response
[
'projects'
].
size
).
to
eq
(
1
)
expect
(
expected_project
[
'id'
]).
to
eq
(
project
.
id
)
...
...
@@ -683,7 +683,7 @@ describe OperationsController do
it
'adds projects to the dasboard'
do
post
:create
,
params:
{
project_ids:
[
project_a
.
id
,
project_b
.
id
.
to_s
]
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
match_schema
(
'dashboard/operations/add'
,
dir:
'ee'
)
expect
(
json_response
[
'added'
]).
to
contain_exactly
(
project_a
.
id
,
project_b
.
id
)
expect
(
json_response
[
'duplicate'
]).
to
be_empty
...
...
@@ -698,7 +698,7 @@ describe OperationsController do
post
:create
,
params:
{
project_ids:
[
project_a
.
id
,
project_b
.
id
.
to_s
]
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
match_schema
(
'dashboard/operations/add'
,
dir:
'ee'
)
expect
(
json_response
[
'added'
]).
to
contain_exactly
(
project_a
.
id
,
project_b
.
id
)
end
...
...
@@ -706,7 +706,7 @@ describe OperationsController do
it
'cannot add a project twice'
do
post
:create
,
params:
{
project_ids:
[
project_a
.
id
,
project_a
.
id
]
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
match_schema
(
'dashboard/operations/add'
,
dir:
'ee'
)
expect
(
json_response
[
'added'
]).
to
contain_exactly
(
project_a
.
id
)
expect
(
json_response
[
'duplicate'
]).
to
be_empty
...
...
@@ -719,7 +719,7 @@ describe OperationsController do
it
'does not add invalid project ids'
do
post
:create
,
params:
{
project_ids:
[
''
,
-
1
,
'-2'
]
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
match_schema
(
'dashboard/operations/add'
,
dir:
'ee'
)
expect
(
json_response
[
'added'
]).
to
be_empty
expect
(
json_response
[
'duplicate'
]).
to
be_empty
...
...
@@ -741,7 +741,7 @@ describe OperationsController do
it
'does not add already added project'
do
post
:create
,
params:
{
project_ids:
[
project
.
id
]
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
match_schema
(
'dashboard/operations/add'
,
dir:
'ee'
)
expect
(
json_response
[
'added'
]).
to
be_empty
expect
(
json_response
[
'duplicate'
]).
to
contain_exactly
(
project
.
id
)
...
...
@@ -778,7 +778,7 @@ describe OperationsController do
it
'removes a project successfully'
do
delete
:destroy
,
params:
{
project_id:
project
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
user
.
reload
expect
(
user
.
ops_dashboard_projects
).
to
eq
([])
...
...
@@ -789,7 +789,7 @@ describe OperationsController do
delete
:destroy
,
params:
{
project_id:
project
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
user
.
reload
expect
(
user
.
ops_dashboard_projects
).
to
eq
([])
end
...
...
@@ -799,7 +799,7 @@ describe OperationsController do
it
'cannot remove invalid project'
do
delete
:destroy
,
params:
{
project_id:
-
1
}
expect
(
response
).
to
have_gitlab_http_status
(
204
)
expect
(
response
).
to
have_gitlab_http_status
(
:no_content
)
end
end
...
...
ee/spec/controllers/projects_controller_spec.rb
View file @
57afac6a
...
...
@@ -42,7 +42,7 @@ describe ProjectsController do
id:
project
.
path
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -133,7 +133,7 @@ describe ProjectsController do
it
'does not create the project from project template'
do
expect
{
post
:create
,
params:
{
project:
templates_params
}
}.
not_to
change
{
Project
.
count
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
.
body
).
to
match
(
/Template name .* is unknown or invalid/
)
end
end
...
...
@@ -154,7 +154,7 @@ describe ProjectsController do
}
project
.
reload
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
params
.
except
(
:repository_size_limit
).
each
do
|
param
,
value
|
expect
(
project
.
public_send
(
param
)).
to
eq
(
value
)
end
...
...
@@ -177,7 +177,7 @@ describe ProjectsController do
}
project
.
reload
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
project
.
approver_groups
.
pluck
(
:group_id
)).
to
contain_exactly
(
params
[
:approver_group_ids
])
expect
(
project
.
approvers
.
pluck
(
:user_id
)).
to
contain_exactly
(
params
[
:approver_ids
])
end
...
...
@@ -196,7 +196,7 @@ describe ProjectsController do
}
project
.
reload
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
params
.
each
do
|
param
,
value
|
expect
(
project
.
public_send
(
param
)).
to
eq
(
value
)
end
...
...
@@ -218,7 +218,7 @@ describe ProjectsController do
}
project
.
reload
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
project
.
service_desk_enabled
).
to
eq
(
true
)
end
...
...
@@ -413,7 +413,7 @@ describe ProjectsController do
delete
:destroy
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
project
.
reload
.
marked_for_deletion?
).
to
be_truthy
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
redirect_to
(
project_path
(
project
))
end
...
...
@@ -424,7 +424,7 @@ describe ProjectsController do
delete
:destroy
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:edit
)
expect
(
flash
[
:alert
]).
to
include
(
message
)
end
...
...
@@ -436,7 +436,7 @@ describe ProjectsController do
delete
:destroy
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
project
.
marked_for_deletion?
).
to
be_falsey
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
redirect_to
(
dashboard_projects_path
)
end
end
...
...
@@ -451,7 +451,7 @@ describe ProjectsController do
delete
:destroy
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
project
.
marked_for_deletion?
).
to
be_falsey
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
redirect_to
(
dashboard_projects_path
)
end
end
...
...
@@ -471,7 +471,7 @@ describe ProjectsController do
expect
(
project
.
reload
.
marked_for_deletion_at
).
to
be_nil
expect
(
project
.
reload
.
archived
).
to
be_falsey
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
redirect_to
(
edit_project_path
(
project
))
end
...
...
@@ -481,7 +481,7 @@ describe ProjectsController do
post
:restore
,
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
(
:edit
)
expect
(
flash
[
:alert
]).
to
include
(
message
)
end
...
...
spec/controllers/acme_challenges_controller_spec.rb
View file @
57afac6a
...
...
@@ -28,7 +28,7 @@ describe AcmeChallengesController do
let
(
:token
)
{
acme_order
.
challenge_token
}
it
'renders not found'
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -37,7 +37,7 @@ describe AcmeChallengesController do
let
(
:token
)
{
'wrongtoken'
}
it
'renders not found'
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
spec/controllers/application_controller_spec.rb
View file @
57afac6a
...
...
@@ -156,7 +156,7 @@ describe ApplicationController do
it
'returns 200 response'
do
get
:index
,
format:
requested_format
expect
(
response
).
to
have_gitlab_http_status
200
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -164,7 +164,7 @@ describe ApplicationController do
it
'returns 404 response'
do
get
:index
expect
(
response
).
to
have_gitlab_http_status
404
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -181,7 +181,7 @@ describe ApplicationController do
get
:index
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
it
'redirects to login page if not authenticated'
do
...
...
@@ -202,7 +202,7 @@ describe ApplicationController do
get
:index
,
format:
'unknown'
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
end
...
...
@@ -489,7 +489,7 @@ describe ApplicationController do
it
'redirects if the user did not accept the terms'
do
get
:index
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
it
'does not redirect when the user accepted terms'
do
...
...
@@ -497,7 +497,7 @@ describe ApplicationController do
get
:index
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
...
...
@@ -581,21 +581,21 @@ describe ApplicationController do
it
'renders a 404 without a message'
do
get
:index
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
response
).
to
render_template
(
'errors/not_found'
)
end
it
'renders a 403 when a message is passed to access denied'
do
get
:index
,
params:
{
message:
'None shall pass'
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
expect
(
response
).
to
render_template
(
'errors/access_denied'
)
end
it
'renders a status passed to access denied'
do
get
:index
,
params:
{
status:
401
}
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
...
...
spec/controllers/autocomplete_controller_spec.rb
View file @
57afac6a
...
...
@@ -32,7 +32,7 @@ describe AutocompleteController do
get
(
:users
,
params:
{
project_id:
'unknown'
})
end
it
{
expect
(
response
).
to
have_gitlab_http_status
(
404
)
}
it
{
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
}
end
end
...
...
@@ -61,7 +61,7 @@ describe AutocompleteController do
get
(
:users
,
params:
{
group_id:
'unknown'
})
end
it
{
expect
(
response
).
to
have_gitlab_http_status
(
404
)
}
it
{
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
}
end
end
...
...
@@ -140,7 +140,7 @@ describe AutocompleteController do
get
(
:users
,
params:
{
project_id:
project
.
id
})
end
it
{
expect
(
response
).
to
have_gitlab_http_status
(
404
)
}
it
{
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
}
end
describe
'GET #users with unknown project'
do
...
...
@@ -148,7 +148,7 @@ describe AutocompleteController do
get
(
:users
,
params:
{
project_id:
'unknown'
})
end
it
{
expect
(
response
).
to
have_gitlab_http_status
(
404
)
}
it
{
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
}
end
describe
'GET #users with inaccessible group'
do
...
...
@@ -157,7 +157,7 @@ describe AutocompleteController do
get
(
:users
,
params:
{
group_id:
user
.
namespace
.
id
})
end
it
{
expect
(
response
).
to
have_gitlab_http_status
(
404
)
}
it
{
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
}
end
describe
'GET #users with no project'
do
...
...
@@ -372,7 +372,7 @@ describe AutocompleteController do
it
'returns empty json'
do
get
:merge_request_target_branches
,
params:
{
project_id:
project
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
be_empty
end
end
...
...
@@ -383,7 +383,7 @@ describe AutocompleteController do
get
:merge_request_target_branches
,
params:
{
project_id:
project
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
be_empty
end
end
...
...
@@ -404,7 +404,7 @@ describe AutocompleteController do
get
:merge_request_target_branches
,
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
:bad_request
)
expect
(
json_response
).
to
eq
({
'error'
=>
'At least one of group_id or project_id must be specified'
})
end
end
...
...
@@ -416,7 +416,7 @@ describe AutocompleteController do
get
:merge_request_target_branches
,
params:
{
project_id:
project
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
contain_exactly
({
'title'
=>
'feature'
})
end
end
...
...
@@ -433,7 +433,7 @@ describe AutocompleteController do
get
:merge_request_target_branches
,
params:
{
group_id:
group
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
contain_exactly
({
'title'
=>
'feature'
})
end
end
...
...
spec/controllers/chaos_controller_spec.rb
View file @
57afac6a
...
...
@@ -9,7 +9,7 @@ describe ChaosController do
get
:leakmem
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'call synchronously with params'
do
...
...
@@ -17,7 +17,7 @@ describe ChaosController do
get
:leakmem
,
params:
{
memory_mb:
1
,
duration_s:
2
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'calls asynchronously'
do
...
...
@@ -25,7 +25,7 @@ describe ChaosController do
get
:leakmem
,
params:
{
async:
1
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -35,7 +35,7 @@ describe ChaosController do
get
:cpu_spin
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'calls synchronously with params'
do
...
...
@@ -43,7 +43,7 @@ describe ChaosController do
get
:cpu_spin
,
params:
{
duration_s:
3
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'calls asynchronously'
do
...
...
@@ -51,7 +51,7 @@ describe ChaosController do
get
:cpu_spin
,
params:
{
async:
1
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -61,7 +61,7 @@ describe ChaosController do
get
:db_spin
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'calls synchronously with params'
do
...
...
@@ -69,7 +69,7 @@ describe ChaosController do
get
:db_spin
,
params:
{
duration_s:
4
,
interval_s:
5
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'calls asynchronously'
do
...
...
@@ -77,7 +77,7 @@ describe ChaosController do
get
:db_spin
,
params:
{
async:
1
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -87,7 +87,7 @@ describe ChaosController do
get
:sleep
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'calls synchronously with params'
do
...
...
@@ -95,7 +95,7 @@ describe ChaosController do
get
:sleep
,
params:
{
duration_s:
5
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'calls asynchronously'
do
...
...
@@ -103,7 +103,7 @@ describe ChaosController do
get
:sleep
,
params:
{
async:
1
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -113,7 +113,7 @@ describe ChaosController do
get
:kill
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'calls asynchronously'
do
...
...
@@ -121,7 +121,7 @@ describe ChaosController do
get
:kill
,
params:
{
async:
1
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
spec/controllers/graphql_controller_spec.rb
View file @
57afac6a
...
...
@@ -39,7 +39,7 @@ describe GraphqlController do
it
'returns 200 when user can access API'
do
post
:execute
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'returns access denied template when user cannot access API'
do
...
...
@@ -59,7 +59,7 @@ describe GraphqlController do
it
'returns 200'
do
post
:execute
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
...
...
spec/controllers/groups_controller_spec.rb
View file @
57afac6a
...
...
@@ -136,7 +136,7 @@ describe GroupsController do
get
:activity
,
params:
{
id:
group
.
to_param
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'count'
]).
to
eq
(
3
)
expect
(
assigns
(
:projects
).
limit_value
).
to
be_nil
end
...
...
@@ -151,7 +151,7 @@ describe GroupsController do
post
:create
,
params:
{
group:
{
name:
'new_group'
,
path:
"new_group"
}
}
end
.
to
change
{
Group
.
count
}.
by
(
1
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
context
'authorization'
do
...
...
@@ -162,7 +162,7 @@ describe GroupsController do
post
:create
,
params:
{
group:
{
name:
'new_group'
,
path:
"new_group"
}
}
end
.
to
change
{
Group
.
count
}.
by
(
1
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
end
...
...
@@ -367,7 +367,7 @@ describe GroupsController do
it
'updates the path successfully'
do
post
:update
,
params:
{
id:
group
.
to_param
,
group:
{
path:
'new_path'
}
}
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
controller
).
to
set_flash
[
:notice
]
end
...
...
@@ -382,7 +382,7 @@ describe GroupsController do
it
'updates the project_creation_level successfully'
do
post
:update
,
params:
{
id:
group
.
to_param
,
group:
{
project_creation_level:
::
Gitlab
::
Access
::
MAINTAINER_PROJECT_ACCESS
}
}
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
group
.
reload
.
project_creation_level
).
to
eq
(
::
Gitlab
::
Access
::
MAINTAINER_PROJECT_ACCESS
)
end
...
...
@@ -397,7 +397,7 @@ describe GroupsController do
post
:update
,
params:
{
id:
group
.
to_param
,
group:
{
name:
'new_name'
}
}
expect
(
controller
).
to
set_flash
[
:notice
]
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
group
.
reload
.
name
).
to
eq
(
'new_name'
)
end
...
...
@@ -405,7 +405,7 @@ describe GroupsController do
post
:update
,
params:
{
id:
group
.
to_param
,
group:
{
path:
'new_path'
}
}
expect
(
assigns
(
:group
).
errors
[
:base
].
first
).
to
match
(
/Docker images in their Container Registry/
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
...
...
@@ -468,7 +468,7 @@ describe GroupsController do
it
'does not redirect'
do
get
:issues
,
params:
{
id:
group
.
to_param
}
expect
(
response
).
not_to
have_gitlab_http_status
(
301
)
expect
(
response
).
not_to
have_gitlab_http_status
(
:moved_permanently
)
end
end
...
...
@@ -487,7 +487,7 @@ describe GroupsController do
it
'does not redirect'
do
get
:show
,
params:
{
id:
group
.
to_param
}
expect
(
response
).
not_to
have_gitlab_http_status
(
301
)
expect
(
response
).
not_to
have_gitlab_http_status
(
:moved_permanently
)
end
end
...
...
@@ -554,13 +554,13 @@ describe GroupsController do
it
'does not 404'
do
post
:update
,
params:
{
id:
group
.
to_param
.
upcase
,
group:
{
path:
'new_path'
}
}
expect
(
response
).
not_to
have_gitlab_http_status
(
404
)
expect
(
response
).
not_to
have_gitlab_http_status
(
:not_found
)
end
it
'does not redirect to the correct casing'
do
post
:update
,
params:
{
id:
group
.
to_param
.
upcase
,
group:
{
path:
'new_path'
}
}
expect
(
response
).
not_to
have_gitlab_http_status
(
301
)
expect
(
response
).
not_to
have_gitlab_http_status
(
:moved_permanently
)
end
end
...
...
@@ -570,7 +570,7 @@ describe GroupsController do
it
'returns not found'
do
post
:update
,
params:
{
id:
redirect_route
.
path
,
group:
{
path:
'new_path'
}
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -580,13 +580,13 @@ describe GroupsController do
it
'does not 404'
do
delete
:destroy
,
params:
{
id:
group
.
to_param
.
upcase
}
expect
(
response
).
not_to
have_gitlab_http_status
(
404
)
expect
(
response
).
not_to
have_gitlab_http_status
(
:not_found
)
end
it
'does not redirect to the correct casing'
do
delete
:destroy
,
params:
{
id:
group
.
to_param
.
upcase
}
expect
(
response
).
not_to
have_gitlab_http_status
(
301
)
expect
(
response
).
not_to
have_gitlab_http_status
(
:moved_permanently
)
end
end
...
...
@@ -596,7 +596,7 @@ describe GroupsController do
it
'returns not found'
do
delete
:destroy
,
params:
{
id:
redirect_route
.
path
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -693,7 +693,7 @@ describe GroupsController do
end
it
'is denied'
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -755,13 +755,13 @@ describe GroupsController do
it
'is successful'
do
get
:show
,
params:
{
id:
group
.
to_param
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'does not allow other formats'
do
get
:show
,
params:
{
id:
group
.
to_param
},
format: :atom
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
...
...
@@ -769,7 +769,7 @@ describe GroupsController do
it
'is successful'
do
get
:edit
,
params:
{
id:
group
.
to_param
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -777,7 +777,7 @@ describe GroupsController do
it
'is successful'
do
get
:new
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -786,7 +786,7 @@ describe GroupsController do
get
:index
# Redirects to the dashboard
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
end
...
...
@@ -810,7 +810,7 @@ describe GroupsController do
it
'deletes the group'
do
delete
:destroy
,
params:
{
id:
group
.
to_param
}
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
end
end
...
...
spec/controllers/health_check_controller_spec.rb
View file @
57afac6a
...
...
@@ -101,7 +101,7 @@ describe HealthCheckController, :request_store do
it
'supports failure plaintext response'
do
get
:index
expect
(
response
).
to
have_gitlab_http_status
(
500
)
expect
(
response
).
to
have_gitlab_http_status
(
:internal_server_error
)
expect
(
response
.
content_type
).
to
eq
'text/plain'
expect
(
response
.
body
).
to
include
(
'The server is on fire'
)
end
...
...
@@ -109,7 +109,7 @@ describe HealthCheckController, :request_store do
it
'supports failure json response'
do
get
:index
,
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
500
)
expect
(
response
).
to
have_gitlab_http_status
(
:internal_server_error
)
expect
(
response
.
content_type
).
to
eq
'application/json'
expect
(
json_response
[
'healthy'
]).
to
be
false
expect
(
json_response
[
'message'
]).
to
include
(
'The server is on fire'
)
...
...
@@ -118,7 +118,7 @@ describe HealthCheckController, :request_store do
it
'supports failure xml response'
do
get
:index
,
format: :xml
expect
(
response
).
to
have_gitlab_http_status
(
500
)
expect
(
response
).
to
have_gitlab_http_status
(
:internal_server_error
)
expect
(
response
.
content_type
).
to
eq
'application/xml'
expect
(
xml_response
[
'healthy'
]).
to
be
false
expect
(
xml_response
[
'message'
]).
to
include
(
'The server is on fire'
)
...
...
@@ -127,7 +127,7 @@ describe HealthCheckController, :request_store do
it
'supports failure responses for specific checks'
do
get
:index
,
params:
{
checks:
'email'
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
500
)
expect
(
response
).
to
have_gitlab_http_status
(
:internal_server_error
)
expect
(
response
.
content_type
).
to
eq
'application/json'
expect
(
json_response
[
'healthy'
]).
to
be
false
expect
(
json_response
[
'message'
]).
to
include
(
'Email is on fire'
)
...
...
spec/controllers/help_controller_spec.rb
View file @
57afac6a
...
...
@@ -148,7 +148,7 @@ describe HelpController do
context
'for UI Development Kit'
do
it
'renders found'
do
get
:ui
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
...
...
spec/controllers/invites_controller_spec.rb
View file @
57afac6a
...
...
@@ -17,7 +17,7 @@ describe InvitesController do
get
:accept
,
params:
{
id:
token
}
member
.
reload
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
member
.
user
).
to
eq
(
user
)
expect
(
flash
[
:notice
]).
to
include
'You have been granted'
end
...
...
@@ -28,7 +28,7 @@ describe InvitesController do
get
:decline
,
params:
{
id:
token
}
expect
{
member
.
reload
}.
to
raise_error
ActiveRecord
::
RecordNotFound
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
flash
[
:notice
]).
to
include
'You have declined the invitation to join'
end
end
...
...
spec/controllers/notification_settings_controller_spec.rb
View file @
57afac6a
...
...
@@ -125,7 +125,7 @@ describe NotificationSettingsController do
notification_setting:
{
level: :participating
}
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -195,7 +195,7 @@ describe NotificationSettingsController do
notification_setting:
{
level: :participating
}
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
spec/controllers/omniauth_callbacks_controller_spec.rb
View file @
57afac6a
...
...
@@ -172,7 +172,7 @@ describe OmniauthCallbacksController, type: :controller, do_not_mock_admin_mode:
it
'returns 403'
do
post
provider
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
end
end
...
...
spec/controllers/passwords_controller_spec.rb
View file @
57afac6a
...
...
@@ -15,7 +15,7 @@ describe PasswordsController do
post
:create
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
flash
[
:alert
]).
to
eq
_
(
'Password authentication is unavailable.'
)
end
end
...
...
spec/controllers/profiles_controller_spec.rb
View file @
57afac6a
...
...
@@ -87,7 +87,7 @@ describe ProfilesController, :request_store do
put
:update
,
params:
{
user:
{
status:
{
message:
'Working hard!'
}
}
}
expect
(
user
.
reload
.
status
.
message
).
to
eq
(
'Working hard!'
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
end
...
...
spec/controllers/projects_controller_spec.rb
View file @
57afac6a
...
...
@@ -27,7 +27,7 @@ describe ProjectsController do
get
:new
,
params:
{
namespace_id:
group
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
'new'
)
end
end
...
...
@@ -36,7 +36,7 @@ describe ProjectsController do
it
'responds with status 404'
do
get
:new
,
params:
{
namespace_id:
group
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
response
).
not_to
render_template
(
'new'
)
end
end
...
...
@@ -159,7 +159,7 @@ describe ProjectsController do
it
'renders a 503'
do
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
503
)
expect
(
response
).
to
have_gitlab_http_status
(
:service_unavailable
)
end
end
...
...
@@ -264,7 +264,7 @@ describe ProjectsController do
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
},
format: :git
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
redirect_to
(
namespace_project_path
)
end
end
...
...
@@ -331,7 +331,7 @@ describe ProjectsController do
id:
project
.
path
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'sets the badge API endpoint'
do
...
...
@@ -371,7 +371,7 @@ describe ProjectsController do
end
it
'redirects to projects path'
do
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
redirect_to
(
project_path
(
project
))
end
end
...
...
@@ -391,7 +391,7 @@ describe ProjectsController do
end
it
'returns 404'
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -419,7 +419,7 @@ describe ProjectsController do
end
it
'redirects to projects path'
do
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
redirect_to
(
project_path
(
project
))
end
end
...
...
@@ -439,7 +439,7 @@ describe ProjectsController do
end
it
'returns 404'
do
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -466,7 +466,7 @@ describe ProjectsController do
id:
project
.
path
}
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
end
...
...
@@ -486,7 +486,7 @@ describe ProjectsController do
id:
project
.
path
}
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
end
end
...
...
@@ -521,7 +521,7 @@ describe ProjectsController do
expect
(
assign_repository_path
).
to
include
(
project
.
path
)
end
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
end
...
...
@@ -537,7 +537,7 @@ describe ProjectsController do
.
not_to
change
{
project
.
reload
.
path
}
expect
(
controller
).
to
set_flash
.
now
[
:alert
].
to
(
s_
(
'UpdateProject|Cannot rename project because it contains container registry tags!'
))
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -555,7 +555,7 @@ describe ProjectsController do
project:
params
}
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
params
.
each
do
|
param
,
value
|
expect
(
project
.
public_send
(
param
)).
to
eq
(
value
)
end
...
...
@@ -653,7 +653,7 @@ describe ProjectsController do
project
.
reload
expect
(
project
.
namespace
).
to
eq
(
new_namespace
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
context
'when new namespace is empty'
do
...
...
@@ -674,7 +674,7 @@ describe ProjectsController do
project
.
reload
expect
(
project
.
namespace
).
to
eq
(
old_namespace
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
flash
[
:alert
]).
to
eq
s_
(
'TransferProject|Please select a new namespace for your project.'
)
end
end
...
...
@@ -691,7 +691,7 @@ describe ProjectsController do
delete
:destroy
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
{
Project
.
find
(
orig_id
)
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
redirect_to
(
dashboard_projects_path
)
end
...
...
@@ -733,7 +733,7 @@ describe ProjectsController do
end
it
'has http status 200'
do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'changes the user incoming email token'
do
...
...
@@ -763,7 +763,7 @@ describe ProjectsController do
end
it
'has http status 200'
do
expect
(
response
).
to
have_
http_status
(
200
)
expect
(
response
).
to
have_
gitlab_http_status
(
:ok
)
end
it
'changes the user incoming email token'
do
...
...
@@ -856,7 +856,7 @@ describe ProjectsController do
id:
project
},
format: :js
)
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
...
...
@@ -905,7 +905,7 @@ describe ProjectsController do
sign_in
(
user
)
get
:refs
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -928,7 +928,7 @@ describe ProjectsController do
it
'returns 404'
do
post
:preview_markdown
,
params:
{
namespace_id:
private_project
.
namespace
,
id:
private_project
,
text:
'*Markdown* text'
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -994,7 +994,7 @@ describe ProjectsController do
get
:show
,
params:
{
namespace_id:
public_project
.
namespace
,
id:
public_project
}
expect
(
assigns
(
:project
)).
to
eq
(
public_project
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -1033,13 +1033,13 @@ describe ProjectsController do
it
'does not 404'
do
post
:toggle_star
,
params:
{
namespace_id:
public_project
.
namespace
,
id:
public_project
.
path
.
upcase
}
expect
(
response
).
not_to
have_gitlab_http_status
(
404
)
expect
(
response
).
not_to
have_gitlab_http_status
(
:not_found
)
end
it
'does not redirect to the correct casing'
do
post
:toggle_star
,
params:
{
namespace_id:
public_project
.
namespace
,
id:
public_project
.
path
.
upcase
}
expect
(
response
).
not_to
have_gitlab_http_status
(
301
)
expect
(
response
).
not_to
have_gitlab_http_status
(
:moved_permanently
)
end
end
...
...
@@ -1049,7 +1049,7 @@ describe ProjectsController do
it
'returns not found'
do
post
:toggle_star
,
params:
{
namespace_id:
'foo'
,
id:
'bar'
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -1063,13 +1063,13 @@ describe ProjectsController do
it
'does not 404'
do
delete
:destroy
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
.
path
.
upcase
}
expect
(
response
).
not_to
have_gitlab_http_status
(
404
)
expect
(
response
).
not_to
have_gitlab_http_status
(
:not_found
)
end
it
'does not redirect to the correct casing'
do
delete
:destroy
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
.
path
.
upcase
}
expect
(
response
).
not_to
have_gitlab_http_status
(
301
)
expect
(
response
).
not_to
have_gitlab_http_status
(
:moved_permanently
)
end
end
...
...
@@ -1079,7 +1079,7 @@ describe ProjectsController do
it
'returns not found'
do
delete
:destroy
,
params:
{
namespace_id:
'foo'
,
id:
'bar'
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -1103,7 +1103,7 @@ describe ProjectsController do
get
action
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
flash
[
:alert
]).
to
eq
(
'This endpoint has been requested too many times. Try again later.'
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
end
...
...
@@ -1114,7 +1114,7 @@ describe ProjectsController do
it
'returns 302'
do
get
action
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
end
...
...
@@ -1126,7 +1126,7 @@ describe ProjectsController do
it
'returns 404'
do
get
action
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -1143,7 +1143,7 @@ describe ProjectsController do
it
'returns 302'
do
get
action
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
end
...
...
@@ -1155,7 +1155,7 @@ describe ProjectsController do
it
'returns 404'
do
get
action
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -1172,7 +1172,7 @@ describe ProjectsController do
it
'returns 302'
do
post
action
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
end
...
...
@@ -1184,7 +1184,7 @@ describe ProjectsController do
it
'returns 404'
do
post
action
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -1196,7 +1196,7 @@ describe ProjectsController do
it
'returns 302'
do
post
action
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
end
end
...
...
@@ -1208,7 +1208,7 @@ describe ProjectsController do
it
'returns 404'
do
post
action
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -1245,7 +1245,7 @@ describe ProjectsController do
it
'redirects to the project page'
do
get
:resolve
,
params:
{
id:
project
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
redirect_to
(
project_path
(
project
))
end
end
...
...
@@ -1267,14 +1267,14 @@ describe ProjectsController do
it
'gives 404 for existing project'
do
get
:resolve
,
params:
{
id:
project
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'gives 404 for non-existing project'
do
get
:resolve
,
params:
{
id:
'0'
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -1288,7 +1288,7 @@ describe ProjectsController do
it
'gives 404 for private project'
do
get
:resolve
,
params:
{
id:
project
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
spec/controllers/registrations_controller_spec.rb
View file @
57afac6a
...
...
@@ -30,7 +30,7 @@ describe RegistrationsController do
it
'renders new template and sets the resource variable'
do
expect
(
subject
).
to
render_template
(
:new
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
assigns
(
:resource
)).
to
be_a
(
User
)
end
end
...
...
@@ -48,7 +48,7 @@ describe RegistrationsController do
it
'renders new template and sets the resource variable'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
redirect_to
(
new_user_session_path
(
anchor:
'register-pane'
))
end
end
...
...
@@ -200,7 +200,7 @@ describe RegistrationsController do
.
and_call_original
expect
(
Gitlab
::
AuthLogger
).
to
receive
(
:error
).
with
(
auth_log_attributes
).
once
expect
{
post
(
:create
,
params:
user_params
,
session:
session_params
)
}.
not_to
change
(
User
,
:count
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
.
body
).
to
be_empty
end
end
...
...
spec/controllers/search_controller_spec.rb
View file @
57afac6a
...
...
@@ -21,13 +21,13 @@ describe SearchController do
it
'blocks access without a project_id'
do
get
action
,
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
it
'allows access with a project_id'
do
get
action
,
params:
params
.
merge
(
project_id:
create
(
:project
,
:public
).
id
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -42,13 +42,13 @@ describe SearchController do
it
'renders a 403 when no project is given'
do
get
action
,
params:
params
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
it
'renders a 200 when a project was set'
do
get
action
,
params:
params
.
merge
(
project_id:
project
.
id
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -57,7 +57,7 @@ describe SearchController do
it
'still allows accessing the search page'
do
get
:show
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -195,7 +195,7 @@ describe SearchController do
get
:count
,
params:
{
search:
'hello'
,
scope:
'projects'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
eq
({
'count'
=>
'1'
})
end
...
...
spec/controllers/sessions_controller_spec.rb
View file @
57afac6a
...
...
@@ -22,7 +22,7 @@ describe SessionsController do
it
'redirects to :omniauth_authorize_path'
do
get
(
:new
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
redirect_to
(
'/saml'
)
end
end
...
...
@@ -31,7 +31,7 @@ describe SessionsController do
it
'responds with 200'
do
get
(
:new
,
params:
{
auto_sign_in:
'false'
})
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
...
...
spec/controllers/snippets_controller_spec.rb
View file @
57afac6a
...
...
@@ -51,7 +51,7 @@ describe SnippetsController do
it
'responds with status 200'
do
get
:new
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
context
'when user is not allowed to create a personal snippet'
do
...
...
@@ -60,7 +60,7 @@ describe SnippetsController do
it
'responds with status 404'
do
get
:new
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -90,7 +90,7 @@ describe SnippetsController do
it
'responds with status 404'
do
get
:show
,
params:
{
id:
other_personal_snippet
.
to_param
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -99,13 +99,13 @@ describe SnippetsController do
get
:show
,
params:
{
id:
personal_snippet
.
to_param
}
expect
(
assigns
(
:snippet
)).
to
eq
(
personal_snippet
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'responds with status 404 when embeddable content is requested'
do
get
:show
,
params:
{
id:
personal_snippet
.
to_param
},
format: :js
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -131,13 +131,13 @@ describe SnippetsController do
get
:show
,
params:
{
id:
personal_snippet
.
to_param
}
expect
(
assigns
(
:snippet
)).
to
eq
(
personal_snippet
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'responds with status 404 when embeddable content is requested'
do
get
:show
,
params:
{
id:
personal_snippet
.
to_param
},
format: :js
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -162,14 +162,14 @@ describe SnippetsController do
get
:show
,
params:
{
id:
personal_snippet
.
to_param
}
expect
(
assigns
(
:snippet
)).
to
eq
(
personal_snippet
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'responds with status 200 when embeddable content is requested'
do
get
:show
,
params:
{
id:
personal_snippet
.
to_param
},
format: :js
expect
(
assigns
(
:snippet
)).
to
eq
(
personal_snippet
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -178,7 +178,7 @@ describe SnippetsController do
get
:show
,
params:
{
id:
personal_snippet
.
to_param
}
expect
(
assigns
(
:snippet
)).
to
eq
(
personal_snippet
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
...
...
@@ -192,7 +192,7 @@ describe SnippetsController do
it
'responds with status 404'
do
get
:show
,
params:
{
id:
'doesntexist'
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -234,7 +234,7 @@ describe SnippetsController do
create_snippet
(
visibility_level:
Snippet
::
PUBLIC
)
end
.
not_to
change
{
Snippet
.
count
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -496,7 +496,7 @@ describe SnippetsController do
it
'responds with status 404'
do
get
:raw
,
params:
{
id:
other_personal_snippet
.
to_param
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -507,7 +507,7 @@ describe SnippetsController do
it
'responds with status 200'
do
expect
(
assigns
(
:snippet
)).
to
eq
(
personal_snippet
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it
'has expected headers'
do
...
...
@@ -517,7 +517,7 @@ describe SnippetsController do
end
it
"sets
#{
Gitlab
::
Workhorse
::
DETECT_HEADER
}
header"
do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
.
header
[
Gitlab
::
Workhorse
::
DETECT_HEADER
]).
to
eq
"true"
end
end
...
...
@@ -544,7 +544,7 @@ describe SnippetsController do
get
:raw
,
params:
{
id:
personal_snippet
.
to_param
}
expect
(
assigns
(
:snippet
)).
to
eq
(
personal_snippet
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -569,7 +569,7 @@ describe SnippetsController do
get
:raw
,
params:
{
id:
personal_snippet
.
to_param
}
expect
(
assigns
(
:snippet
)).
to
eq
(
personal_snippet
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
context
'CRLF line ending'
do
...
...
@@ -596,7 +596,7 @@ describe SnippetsController do
get
:raw
,
params:
{
id:
personal_snippet
.
to_param
}
expect
(
assigns
(
:snippet
)).
to
eq
(
personal_snippet
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
end
...
...
@@ -610,7 +610,7 @@ describe SnippetsController do
it
'responds with status 404'
do
get
:raw
,
params:
{
id:
'doesntexist'
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -712,7 +712,7 @@ describe SnippetsController do
it
'responds with status 404'
do
delete
:destroy
,
params:
{
id:
snippet
.
to_param
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
spec/controllers/uploads_controller_spec.rb
View file @
57afac6a
...
...
@@ -46,7 +46,7 @@ describe UploadsController do
it
"returns 401 when the user is not logged in"
do
post
:create
,
params:
{
model:
model
,
id:
snippet
.
id
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
it
"returns 404 when user can't comment on a snippet"
do
...
...
@@ -55,7 +55,7 @@ describe UploadsController do
sign_in
(
user
)
post
:create
,
params:
{
model:
model
,
id:
private_snippet
.
id
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -67,7 +67,7 @@ describe UploadsController do
it
"returns an error without file"
do
post
:create
,
params:
{
model:
model
,
id:
snippet
.
id
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
422
)
expect
(
response
).
to
have_gitlab_http_status
(
:unprocessable_entity
)
end
it
"returns an error with invalid model"
do
...
...
@@ -78,7 +78,7 @@ describe UploadsController do
it
"returns 404 status when object not found"
do
post
:create
,
params:
{
model:
model
,
id:
9999
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
context
'with valid image'
do
...
...
@@ -129,7 +129,7 @@ describe UploadsController do
it
'returns 401 when the user has no access'
do
post
:create
,
params:
{
model:
'user'
,
id:
user
.
id
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
context
'when user is logged in'
do
...
...
@@ -188,7 +188,7 @@ describe UploadsController do
post
:create
,
params:
{
model:
model
,
id:
another_user
.
id
,
file:
txt
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -246,7 +246,7 @@ describe UploadsController do
it
"responds with status 401"
do
get
:show
,
params:
{
model:
"user"
,
mounted_as:
"avatar"
,
id:
user
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
...
...
@@ -254,7 +254,7 @@ describe UploadsController do
it
"responds with status 200"
do
get
:show
,
params:
{
model:
"user"
,
mounted_as:
"avatar"
,
id:
user
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it_behaves_like
'content publicly cached'
do
...
...
@@ -271,7 +271,7 @@ describe UploadsController do
it
"responds with status 200"
do
get
:show
,
params:
{
model:
"user"
,
mounted_as:
"avatar"
,
id:
user
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it_behaves_like
'content publicly cached'
do
...
...
@@ -296,7 +296,7 @@ describe UploadsController do
it
"responds with status 200"
do
get
:show
,
params:
{
model:
"project"
,
mounted_as:
"avatar"
,
id:
project
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it_behaves_like
'content 5 min private cached with revalidation'
do
...
...
@@ -316,7 +316,7 @@ describe UploadsController do
it
"responds with status 200"
do
get
:show
,
params:
{
model:
"project"
,
mounted_as:
"avatar"
,
id:
project
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it_behaves_like
'content 5 min private cached with revalidation'
do
...
...
@@ -338,7 +338,7 @@ describe UploadsController do
it
"responds with status 401"
do
get
:show
,
params:
{
model:
"project"
,
mounted_as:
"avatar"
,
id:
project
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
...
...
@@ -361,7 +361,7 @@ describe UploadsController do
it
"responds with status 401"
do
get
:show
,
params:
{
model:
"project"
,
mounted_as:
"avatar"
,
id:
project
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
...
...
@@ -369,7 +369,7 @@ describe UploadsController do
it
"responds with status 200"
do
get
:show
,
params:
{
model:
"project"
,
mounted_as:
"avatar"
,
id:
project
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it_behaves_like
'content 5 min private cached with revalidation'
do
...
...
@@ -386,7 +386,7 @@ describe UploadsController do
it
"responds with status 404"
do
get
:show
,
params:
{
model:
"project"
,
mounted_as:
"avatar"
,
id:
project
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -401,7 +401,7 @@ describe UploadsController do
it
"responds with status 200"
do
get
:show
,
params:
{
model:
"group"
,
mounted_as:
"avatar"
,
id:
group
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it_behaves_like
'content 5 min private cached with revalidation'
do
...
...
@@ -421,7 +421,7 @@ describe UploadsController do
it
"responds with status 200"
do
get
:show
,
params:
{
model:
"group"
,
mounted_as:
"avatar"
,
id:
group
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it_behaves_like
'content 5 min private cached with revalidation'
do
...
...
@@ -457,7 +457,7 @@ describe UploadsController do
it
"responds with status 401"
do
get
:show
,
params:
{
model:
"group"
,
mounted_as:
"avatar"
,
id:
group
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
...
...
@@ -465,7 +465,7 @@ describe UploadsController do
it
"responds with status 200"
do
get
:show
,
params:
{
model:
"group"
,
mounted_as:
"avatar"
,
id:
group
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it_behaves_like
'content 5 min private cached with revalidation'
do
...
...
@@ -482,7 +482,7 @@ describe UploadsController do
it
"responds with status 404"
do
get
:show
,
params:
{
model:
"group"
,
mounted_as:
"avatar"
,
id:
group
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -502,7 +502,7 @@ describe UploadsController do
it
"responds with status 200"
do
get
:show
,
params:
{
model:
"note"
,
mounted_as:
"attachment"
,
id:
note
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it_behaves_like
'content not cached'
do
...
...
@@ -522,7 +522,7 @@ describe UploadsController do
it
"responds with status 200"
do
get
:show
,
params:
{
model:
"note"
,
mounted_as:
"attachment"
,
id:
note
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it_behaves_like
'content not cached'
do
...
...
@@ -544,7 +544,7 @@ describe UploadsController do
it
"responds with status 401"
do
get
:show
,
params:
{
model:
"note"
,
mounted_as:
"attachment"
,
id:
note
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
...
...
@@ -567,7 +567,7 @@ describe UploadsController do
it
"responds with status 401"
do
get
:show
,
params:
{
model:
"note"
,
mounted_as:
"attachment"
,
id:
note
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
...
...
@@ -575,7 +575,7 @@ describe UploadsController do
it
"responds with status 200"
do
get
:show
,
params:
{
model:
"note"
,
mounted_as:
"attachment"
,
id:
note
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it_behaves_like
'content not cached'
do
...
...
@@ -592,7 +592,7 @@ describe UploadsController do
it
"responds with status 404"
do
get
:show
,
params:
{
model:
"note"
,
mounted_as:
"attachment"
,
id:
note
.
id
,
filename:
"dk.png"
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -607,7 +607,7 @@ describe UploadsController do
it
'responds with status 200'
do
get
:show
,
params:
{
model:
'appearance'
,
mounted_as:
'header_logo'
,
id:
appearance
.
id
,
filename:
'dk.png'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it_behaves_like
'content publicly cached'
do
...
...
@@ -627,7 +627,7 @@ describe UploadsController do
it
'responds with status 200'
do
get
:show
,
params:
{
model:
'appearance'
,
mounted_as:
'logo'
,
id:
appearance
.
id
,
filename:
'dk.png'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it_behaves_like
'content publicly cached'
do
...
...
@@ -648,7 +648,7 @@ describe UploadsController do
it
'successfully returns the file'
do
get
:show
,
params:
{
model:
'appearance'
,
mounted_as:
'favicon'
,
id:
appearance
.
id
,
filename:
'dk.png'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
.
header
[
'Content-Disposition'
]).
to
end_with
'filename="dk.png"'
end
end
...
...
@@ -657,7 +657,7 @@ describe UploadsController do
it
'returns a 404'
do
get
:show
,
params:
{
model:
'appearance'
,
mounted_as:
'favicon'
,
id:
appearance
.
id
,
filename:
'bogus.png'
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
spec/controllers/users_controller_spec.rb
View file @
57afac6a
...
...
@@ -28,7 +28,7 @@ describe UsersController do
it
'renders the show template'
do
get
:show
,
params:
{
username:
user
.
username
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
'show'
)
end
end
...
...
@@ -53,7 +53,7 @@ describe UsersController do
it
'renders show'
do
get
:show
,
params:
{
username:
user
.
username
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
'show'
)
end
end
...
...
@@ -74,7 +74,7 @@ describe UsersController do
it
'renders 404'
do
get
:show
,
params:
{
username:
'nonexistent'
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -130,7 +130,7 @@ describe UsersController do
get
:calendar
,
params:
{
username:
public_user
.
username
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -285,7 +285,7 @@ describe UsersController do
context
'format html'
do
it
'renders snippets page'
do
get
:snippets
,
params:
{
username:
user
.
username
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
'show'
)
end
end
...
...
@@ -293,7 +293,7 @@ describe UsersController do
context
'format json'
do
it
'response with snippets json data'
do
get
:snippets
,
params:
{
username:
user
.
username
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
have_key
(
'html'
)
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