Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
3f52e717
Unverified
Commit
3f52e717
authored
2 years ago
by
Claire
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for moderation actions without custom text (#23184)
parent
6b16b77a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/controllers/admin/reports/actions_controller_spec.rb
+25
-2
25 additions, 2 deletions
spec/controllers/admin/reports/actions_controller_spec.rb
with
25 additions
and
2 deletions
spec/controllers/admin/reports/actions_controller_spec.rb
+
25
−
2
View file @
3f52e717
...
...
@@ -57,6 +57,9 @@ describe Admin::Reports::ActionsController do
let!
(
:media
)
{
Fabricate
(
:media_attachment
,
account:
target_account
,
status:
statuses
[
0
])
}
let
(
:report
)
{
Fabricate
(
:report
,
target_account:
target_account
,
status_ids:
statuses
.
map
(
&
:id
))
}
let
(
:text
)
{
'hello'
}
let
(
:common_params
)
do
{
report_id:
report
.
id
,
text:
text
}
end
shared_examples
'common behavior'
do
it
'closes the report'
do
...
...
@@ -72,6 +75,26 @@ describe Admin::Reports::ActionsController do
subject
expect
(
response
).
to
redirect_to
(
admin_reports_path
)
end
context
'when text is unset'
do
let
(
:common_params
)
do
{
report_id:
report
.
id
}
end
it
'closes the report'
do
expect
{
subject
}.
to
change
{
report
.
reload
.
action_taken?
}.
from
(
false
).
to
(
true
)
end
it
'creates a strike with the expected text'
do
expect
{
subject
}.
to
change
{
report
.
target_account
.
strikes
.
count
}.
by
(
1
)
expect
(
report
.
target_account
.
strikes
.
last
.
text
).
to
eq
''
end
it
'redirects'
do
subject
expect
(
response
).
to
redirect_to
(
admin_reports_path
)
end
end
end
shared_examples
'all action types'
do
...
...
@@ -124,13 +147,13 @@ describe Admin::Reports::ActionsController do
end
context
'action as submit button'
do
subject
{
post
:create
,
params:
{
report_id:
report
.
id
,
text:
text
,
action
=>
''
}
}
subject
{
post
:create
,
params:
common_params
.
merge
({
action
=>
''
}
)
}
it_behaves_like
'all action types'
end
context
'action as submit button'
do
subject
{
post
:create
,
params:
{
report_id:
report
.
id
,
text:
text
,
moderation_action:
action
}
}
subject
{
post
:create
,
params:
common_params
.
merge
({
moderation_action:
action
}
)
}
it_behaves_like
'all action types'
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment