]>
cat aescling's git repositories - mastodon.git/blob - spec/controllers/admin/reports_controller_spec.rb
3 describe Admin
::ReportsController do
6 let(:user) { Fabricate(:user, admin
: true) }
8 sign_in user
, scope
: :user
11 describe
'GET #index' do
12 it
'returns http success with no filters' do
13 specified
= Fabricate(:report, action_taken
: false)
14 Fabricate(:report, action_taken
: true)
18 reports
= assigns(:reports).to_a
19 expect(reports
.size
).to eq
1
20 expect(reports
[0]).to eq specified
21 expect(response
).to
have_http_status(200)
24 it
'returns http success with resolved filter' do
25 specified
= Fabricate(:report, action_taken
: true)
26 Fabricate(:report, action_taken
: false)
28 get
:index, params
: { resolved
: 1 }
30 reports
= assigns(:reports).to_a
31 expect(reports
.size
).to eq
1
32 expect(reports
[0]).to eq specified
34 expect(response
).to
have_http_status(200)
38 describe
'GET #show' do
39 it
'renders report' do
40 report
= Fabricate(:report)
42 get
:show, params
: { id
: report
}
44 expect(assigns(:report)).to eq report
45 expect(response
).to
have_http_status(200)
49 describe
'POST #reopen' do
50 it
'reopens the report' do
51 report
= Fabricate(:report)
53 put
:reopen, params
: { id
: report
}
54 expect(response
).to
redirect_to(admin_report_path(report
))
56 expect(report
.action_taken_by_account
).to eq
nil
57 expect(report
.action_taken
).to eq
false
61 describe
'POST #assign_to_self' do
62 it
'reopens the report' do
63 report
= Fabricate(:report)
65 put
:assign_to_self, params
: { id
: report
}
66 expect(response
).to
redirect_to(admin_report_path(report
))
68 expect(report
.assigned_account
).to eq user
.account
72 describe
'POST #unassign' do
73 it
'reopens the report' do
74 report
= Fabricate(:report)
76 put
:unassign, params
: { id
: report
}
77 expect(response
).to
redirect_to(admin_report_path(report
))
79 expect(report
.assigned_account
).to eq
nil
This page took 0.089242 seconds and 4 git commands to generate.