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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
a09323c9
Commit
a09323c9
authored
Mar 07, 2016
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix broken specs
parent
4231cfeb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
+7
-10
app/controllers/admin/abuse_reports_controller.rb
app/controllers/admin/abuse_reports_controller.rb
+1
-1
spec/models/abuse_report_spec.rb
spec/models/abuse_report_spec.rb
+6
-9
No files found.
app/controllers/admin/abuse_reports_controller.rb
View file @
a09323c9
...
...
@@ -6,7 +6,7 @@ class Admin::AbuseReportsController < Admin::ApplicationController
def
destroy
abuse_report
=
AbuseReport
.
find
(
params
[
:id
])
abuse_report
.
remove_user
if
params
[
:remove_user
]
abuse_report
.
remove_user
(
current_user
)
if
params
[
:remove_user
]
abuse_report
.
destroy
render
nothing:
true
...
...
spec/models/abuse_report_spec.rb
View file @
a09323c9
...
...
@@ -13,7 +13,8 @@
require
'rails_helper'
RSpec
.
describe
AbuseReport
,
type: :model
do
subject
{
create
(
:abuse_report
)
}
subject
{
create
(
:abuse_report
)
}
let
(
:user
)
{
create
(
:user
)
}
it
{
expect
(
subject
).
to
be_valid
}
...
...
@@ -31,17 +32,13 @@ RSpec.describe AbuseReport, type: :model do
describe
'#remove_user'
do
it
'blocks the user'
do
report
=
build
(
:abuse_report
)
allow
(
report
.
user
).
to
receive
(
:destroy
)
expect
{
report
.
remove_user
}.
to
change
{
report
.
user
.
blocked?
}.
to
(
true
)
expect
{
subject
.
remove_user
(
user
)
}.
to
change
{
subject
.
user
.
blocked?
}.
to
(
true
)
end
it
'
removes
the user'
do
report
=
build
(
:abuse_report
)
it
'
lets a worker delete
the user'
do
expect
(
DeleteUserWorker
).
to
receive
(
:perform_async
).
with
(
user
.
id
,
subject
.
user
.
id
,
force:
true
)
expect
{
report
.
remove_user
}.
to
change
{
User
.
count
}.
by
(
-
1
)
subject
.
remove_user
(
user
)
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