about summary refs log tree commit diff
path: root/spec/controllers
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2020-03-22 16:10:44 +0100
committerThibaut Girka <thib@sitedethib.com>2020-03-22 16:10:44 +0100
commit9abb227250bd2b377d96626122d431ba30c5f5e0 (patch)
treec3072e0098155cbb7b6f86830cfd0b174703f23e /spec/controllers
parent7115b0b8c99b7e88aee264be75945e592dec33e4 (diff)
parentcd6d851d83c38c4f160ae939e08a913bd98fbd8f (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- `README.md`:
  Our README.md files are completely different. Discarded upstream changes.
- `app/javascript/core/admin.js`:
  Updating rails-ujs, no real conflict, but a comment to close to changed
  code. Various glitch-soc-only files have been updated to match those changes,
  though.
- `package.json`:
  No real conflict, just an additional dependency in glitch-soc that was too
  close to something updated upstream. Took upstream's changes.
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/admin/reports_controller_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/controllers/admin/reports_controller_spec.rb b/spec/controllers/admin/reports_controller_spec.rb
index b428299ee..49d3e9707 100644
--- a/spec/controllers/admin/reports_controller_spec.rb
+++ b/spec/controllers/admin/reports_controller_spec.rb
@@ -46,6 +46,26 @@ describe Admin::ReportsController do
     end
   end
 
+  describe 'POST #resolve' do
+    it 'resolves the report' do
+      report = Fabricate(:report)
+
+      put :resolve, params: { id: report }
+      expect(response).to redirect_to(admin_reports_path)
+      report.reload
+      expect(report.action_taken_by_account).to eq user.account
+      expect(report.action_taken).to eq true
+    end
+
+    it 'sets trust level when the report is an antispam one' do
+      report = Fabricate(:report, account: Account.representative)
+
+      put :resolve, params: { id: report }
+      report.reload
+      expect(report.target_account.trust_level).to eq Account::TRUST_LEVELS[:trusted]
+    end
+  end
+
   describe 'POST #reopen' do
     it 'reopens the report' do
       report = Fabricate(:report)