about summary refs log tree commit diff
path: root/spec/controllers/admin
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-05-04 16:37:26 +0200
committerThibaut Girka <thib@sitedethib.com>2019-05-04 16:37:26 +0200
commit33c80e07838d932efc6214cb1642cefaeb624b67 (patch)
tree51cae2d9096888cc27ae38ec4b0ceceb1853bb73 /spec/controllers/admin
parent2c2f649200ba5b742ba9d17ac5ba553c752b59aa (diff)
parentc88d9e524b02cba895de9bdb7cba0e29e37703d5 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- app/models/media_attachment.rb
Diffstat (limited to 'spec/controllers/admin')
-rw-r--r--spec/controllers/admin/domain_blocks_controller_spec.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/controllers/admin/domain_blocks_controller_spec.rb b/spec/controllers/admin/domain_blocks_controller_spec.rb
index 129bf8883..2a8675c21 100644
--- a/spec/controllers/admin/domain_blocks_controller_spec.rb
+++ b/spec/controllers/admin/domain_blocks_controller_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
     end
 
     it 'renders new when failed to save' do
-      Fabricate(:domain_block, domain: 'example.com')
+      Fabricate(:domain_block, domain: 'example.com', severity: 'suspend')
       allow(DomainBlockWorker).to receive(:perform_async).and_return(true)
 
       post :create, params: { domain_block: { domain: 'example.com', severity: 'silence' } }
@@ -45,6 +45,17 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do
       expect(DomainBlockWorker).not_to have_received(:perform_async)
       expect(response).to render_template :new
     end
+
+    it 'allows upgrading a block' do
+      Fabricate(:domain_block, domain: 'example.com', severity: 'silence')
+      allow(DomainBlockWorker).to receive(:perform_async).and_return(true)
+
+      post :create, params: { domain_block: { domain: 'example.com', severity: 'silence', reject_media: true, reject_reports: true } }
+
+      expect(DomainBlockWorker).to have_received(:perform_async)
+      expect(flash[:notice]).to eq I18n.t('admin.domain_blocks.created_msg')
+      expect(response).to redirect_to(admin_instances_path(limited: '1'))
+    end
   end
 
   describe 'DELETE #destroy' do