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