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
50d9c79a
Commit
50d9c79a
authored
Dec 16, 2021
by
Lee Tickett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transition abuse_reports_controller spec
Changelog: fixed
parent
f8a18573
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
9 deletions
+14
-9
app/controllers/abuse_reports_controller.rb
app/controllers/abuse_reports_controller.rb
+3
-1
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/requests/abuse_reports_controller_spec.rb
spec/requests/abuse_reports_controller_spec.rb
+8
-8
No files found.
app/controllers/abuse_reports_controller.rb
View file @
50d9c79a
...
...
@@ -20,8 +20,10 @@ class AbuseReportsController < ApplicationController
message
=
_
(
"Thank you for your report. A GitLab administrator will look into it shortly."
)
redirect_to
root_path
,
notice:
message
els
e
els
if
report_params
[
:user_id
].
present?
render
:new
else
redirect_to
root_path
,
alert:
_
(
"Cannot create the abuse report. The reported user was invalid. Please try again or contact support."
)
end
end
...
...
locale/gitlab.pot
View file @
50d9c79a
...
...
@@ -6530,6 +6530,9 @@ msgstr ""
msgid "Cannot be merged automatically"
msgstr ""
msgid "Cannot create the abuse report. The reported user was invalid. Please try again or contact support."
msgstr ""
msgid "Cannot create the abuse report. The user has been deleted."
msgstr ""
...
...
spec/
controller
s/abuse_reports_controller_spec.rb
→
spec/
request
s/abuse_reports_controller_spec.rb
View file @
50d9c79a
...
...
@@ -21,7 +21,7 @@ RSpec.describe AbuseReportsController do
user_id
=
user
.
id
user
.
destroy!
get
:new
,
params:
{
user_id:
user_id
}
get
new_abuse_report_path
(
user_id:
user_id
)
expect
(
response
).
to
redirect_to
root_path
expect
(
flash
[
:alert
]).
to
eq
(
_
(
'Cannot create the abuse report. The user has been deleted.'
))
...
...
@@ -32,7 +32,7 @@ RSpec.describe AbuseReportsController do
it
'redirects the reporter to the user\'s profile'
do
user
.
block
get
:new
,
params:
{
user_id:
user
.
id
}
get
new_abuse_report_path
(
user_id:
user
.
id
)
expect
(
response
).
to
redirect_to
user
expect
(
flash
[
:alert
]).
to
eq
(
_
(
'Cannot create the abuse report. This user has been blocked.'
))
...
...
@@ -44,7 +44,7 @@ RSpec.describe AbuseReportsController do
context
'with valid attributes'
do
it
'saves the abuse report'
do
expect
do
post
:create
,
params:
{
abuse_report:
attrs
}
post
abuse_reports_path
(
abuse_report:
attrs
)
end
.
to
change
{
AbuseReport
.
count
}.
by
(
1
)
end
...
...
@@ -53,22 +53,22 @@ RSpec.describe AbuseReportsController do
expect
(
instance
).
to
receive
(
:notify
)
end
post
:create
,
params:
{
abuse_report:
attrs
}
post
abuse_reports_path
(
abuse_report:
attrs
)
end
it
'redirects back to root'
do
post
:create
,
params:
{
abuse_report:
attrs
}
post
abuse_reports_path
(
abuse_report:
attrs
)
expect
(
response
).
to
redirect_to
root_path
end
end
context
'with invalid attributes'
do
it
're
nders new
'
do
it
're
directs back to root
'
do
attrs
.
delete
(
:user_id
)
post
:create
,
params:
{
abuse_report:
attrs
}
post
abuse_reports_path
(
abuse_report:
attrs
)
expect
(
response
).
to
re
nder_template
(
:new
)
expect
(
response
).
to
re
direct_to
root_path
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