diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-05-09 17:43:30 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2018-05-10 00:03:28 +0200 |
commit | 1c9c0167b7ea7dd03ef233a085adc0a6ef1b2527 (patch) | |
tree | ccfcb53c4ddb61d7ef3158d29403ff7cd6516e55 /spec/controllers/admin/statuses_controller_spec.rb | |
parent | 143878d9dadd03347c54c9261b9bc754a1d0f5bc (diff) | |
parent | ac788ad47e32a3cf84a46ac87f84f376185cdad4 (diff) |
Merge branch 'master' into glitch-soc/master
Conflicts: app/models/account.rb app/views/accounts/_header.html.haml
Diffstat (limited to 'spec/controllers/admin/statuses_controller_spec.rb')
-rw-r--r-- | spec/controllers/admin/statuses_controller_spec.rb | 48 |
1 files changed, 9 insertions, 39 deletions
diff --git a/spec/controllers/admin/statuses_controller_spec.rb b/spec/controllers/admin/statuses_controller_spec.rb index cbaf39786..6afcc1442 100644 --- a/spec/controllers/admin/statuses_controller_spec.rb +++ b/spec/controllers/admin/statuses_controller_spec.rb @@ -34,13 +34,13 @@ describe Admin::StatusesController do describe 'POST #create' do subject do - -> { post :create, params: { account_id: account.id, form_status_batch: { action: action, status_ids: status_ids } } } + -> { post :create, params: { :account_id => account.id, action => '', :form_status_batch => { status_ids: status_ids } } } end let(:action) { 'nsfw_on' } let(:status_ids) { [media_attached_status.id] } - context 'updates sensitive column to true' do + context 'when action is nsfw_on' do it 'updates sensitive column' do is_expected.to change { media_attached_status.reload.sensitive @@ -48,7 +48,7 @@ describe Admin::StatusesController do end end - context 'updates sensitive column to false' do + context 'when action is nsfw_off' do let(:action) { 'nsfw_off' } let(:sensitive) { false } @@ -59,32 +59,13 @@ describe Admin::StatusesController do end end - it 'redirects to account statuses page' do - subject.call - expect(response).to redirect_to(admin_account_statuses_path(account.id)) - end - end - - describe 'PATCH #update' do - subject do - -> { patch :update, params: { account_id: account.id, id: media_attached_status, status: { sensitive: sensitive } } } - end - - context 'updates sensitive column to true' do - it 'updates sensitive column' do - is_expected.to change { - media_attached_status.reload.sensitive - }.from(false).to(true) - end - end - - context 'updates sensitive column to false' do - let(:sensitive) { false } + context 'when action is delete' do + let(:action) { 'delete' } - it 'updates sensitive column' do - is_expected.to change { - media_attached_status.reload.sensitive - }.from(true).to(false) + it 'removes a status' do + allow(RemovalWorker).to receive(:perform_async) + subject.call + expect(RemovalWorker).to have_received(:perform_async).with(status_ids.first) end end @@ -93,15 +74,4 @@ describe Admin::StatusesController do expect(response).to redirect_to(admin_account_statuses_path(account.id)) end end - - describe 'DELETE #destroy' do - it 'removes a status' do - allow(RemovalWorker).to receive(:perform_async) - - delete :destroy, params: { account_id: account.id, id: status } - expect(response).to have_http_status(200) - expect(RemovalWorker). - to have_received(:perform_async).with(status.id) - end - end end |