Reduce round trips in admin/disputes/appeals spec (#29234)
This commit is contained in:
parent
3454fcbd71
commit
1946e171e6
|
@ -30,21 +30,19 @@ RSpec.describe Admin::Disputes::AppealsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST #approve' do
|
describe 'POST #approve' do
|
||||||
|
subject { post :approve, params: { id: appeal.id } }
|
||||||
|
|
||||||
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||||
|
|
||||||
before do
|
it 'redirects back to the strike page and notifies target account about approved appeal', :sidekiq_inline do
|
||||||
post :approve, params: { id: appeal.id }
|
subject
|
||||||
end
|
|
||||||
|
|
||||||
it 'unsuspends a suspended account' do
|
expect(response)
|
||||||
expect(target_account.reload.suspended?).to be false
|
.to redirect_to(disputes_strike_path(appeal.strike))
|
||||||
end
|
|
||||||
|
|
||||||
it 'redirects back to the strike page' do
|
expect(target_account.reload)
|
||||||
expect(response).to redirect_to(disputes_strike_path(appeal.strike))
|
.to_not be_suspended
|
||||||
end
|
|
||||||
|
|
||||||
it 'notifies target account about approved appeal', :sidekiq_inline do
|
|
||||||
expect(UserMailer.deliveries.size).to eq(1)
|
expect(UserMailer.deliveries.size).to eq(1)
|
||||||
expect(UserMailer.deliveries.first.to.first).to eq(target_account.user.email)
|
expect(UserMailer.deliveries.first.to.first).to eq(target_account.user.email)
|
||||||
expect(UserMailer.deliveries.first.subject).to eq(I18n.t('user_mailer.appeal_approved.subject', date: I18n.l(appeal.created_at)))
|
expect(UserMailer.deliveries.first.subject).to eq(I18n.t('user_mailer.appeal_approved.subject', date: I18n.l(appeal.created_at)))
|
||||||
|
@ -52,17 +50,16 @@ RSpec.describe Admin::Disputes::AppealsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST #reject' do
|
describe 'POST #reject' do
|
||||||
|
subject { post :reject, params: { id: appeal.id } }
|
||||||
|
|
||||||
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||||
|
|
||||||
before do
|
it 'redirects back to the strike page and notifies target account about rejected appeal', :sidekiq_inline do
|
||||||
post :reject, params: { id: appeal.id }
|
subject
|
||||||
end
|
|
||||||
|
|
||||||
it 'redirects back to the strike page' do
|
expect(response)
|
||||||
expect(response).to redirect_to(disputes_strike_path(appeal.strike))
|
.to redirect_to(disputes_strike_path(appeal.strike))
|
||||||
end
|
|
||||||
|
|
||||||
it 'notifies target account about rejected appeal', :sidekiq_inline do
|
|
||||||
expect(UserMailer.deliveries.size).to eq(1)
|
expect(UserMailer.deliveries.size).to eq(1)
|
||||||
expect(UserMailer.deliveries.first.to.first).to eq(target_account.user.email)
|
expect(UserMailer.deliveries.first.to.first).to eq(target_account.user.email)
|
||||||
expect(UserMailer.deliveries.first.subject).to eq(I18n.t('user_mailer.appeal_rejected.subject', date: I18n.l(appeal.created_at)))
|
expect(UserMailer.deliveries.first.subject).to eq(I18n.t('user_mailer.appeal_rejected.subject', date: I18n.l(appeal.created_at)))
|
||||||
|
|
Loading…
Reference in New Issue