Eliminate double subject call in admin/ controller specs (#28158)
This commit is contained in:
parent
8710bdb183
commit
b751078fcd
3 changed files with 16 additions and 16 deletions
|
@ -20,7 +20,7 @@ RSpec.describe Admin::AccountModerationNotesController do
|
||||||
|
|
||||||
it 'successfully creates a note' do
|
it 'successfully creates a note' do
|
||||||
expect { subject }.to change(AccountModerationNote, :count).by(1)
|
expect { subject }.to change(AccountModerationNote, :count).by(1)
|
||||||
expect(subject).to redirect_to admin_account_path(target_account.id)
|
expect(response).to redirect_to admin_account_path(target_account.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ RSpec.describe Admin::AccountModerationNotesController do
|
||||||
|
|
||||||
it 'falls to create a note' do
|
it 'falls to create a note' do
|
||||||
expect { subject }.to_not change(AccountModerationNote, :count)
|
expect { subject }.to_not change(AccountModerationNote, :count)
|
||||||
expect(subject).to render_template 'admin/accounts/show'
|
expect(response).to render_template 'admin/accounts/show'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -42,7 +42,7 @@ RSpec.describe Admin::AccountModerationNotesController do
|
||||||
|
|
||||||
it 'destroys note' do
|
it 'destroys note' do
|
||||||
expect { subject }.to change(AccountModerationNote, :count).by(-1)
|
expect { subject }.to change(AccountModerationNote, :count).by(-1)
|
||||||
expect(subject).to redirect_to admin_account_path(target_account.id)
|
expect(response).to redirect_to admin_account_path(target_account.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,24 +12,24 @@ describe Admin::CustomEmojisController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #index' do
|
describe 'GET #index' do
|
||||||
subject { get :index }
|
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Fabricate(:custom_emoji)
|
Fabricate(:custom_emoji)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'renders index page' do
|
it 'renders index page' do
|
||||||
expect(subject).to have_http_status 200
|
get :index
|
||||||
expect(subject).to render_template :index
|
|
||||||
|
expect(response).to have_http_status 200
|
||||||
|
expect(response).to render_template :index
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #new' do
|
describe 'GET #new' do
|
||||||
subject { get :new }
|
|
||||||
|
|
||||||
it 'renders new page' do
|
it 'renders new page' do
|
||||||
expect(subject).to have_http_status 200
|
get :new
|
||||||
expect(subject).to render_template :new
|
|
||||||
|
expect(response).to have_http_status 200
|
||||||
|
expect(response).to render_template :new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ describe Admin::ReportNotesController do
|
||||||
it 'creates a report note and resolves report' do
|
it 'creates a report note and resolves report' do
|
||||||
expect { subject }.to change(ReportNote, :count).by(1)
|
expect { subject }.to change(ReportNote, :count).by(1)
|
||||||
expect(report.reload).to be_action_taken
|
expect(report.reload).to be_action_taken
|
||||||
expect(subject).to redirect_to admin_reports_path
|
expect(response).to redirect_to admin_reports_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ describe Admin::ReportNotesController do
|
||||||
it 'creates a report note and does not resolve report' do
|
it 'creates a report note and does not resolve report' do
|
||||||
expect { subject }.to change(ReportNote, :count).by(1)
|
expect { subject }.to change(ReportNote, :count).by(1)
|
||||||
expect(report.reload).to_not be_action_taken
|
expect(report.reload).to_not be_action_taken
|
||||||
expect(subject).to redirect_to admin_report_path(report)
|
expect(response).to redirect_to admin_report_path(report)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -52,7 +52,7 @@ describe Admin::ReportNotesController do
|
||||||
it 'creates a report note and unresolves report' do
|
it 'creates a report note and unresolves report' do
|
||||||
expect { subject }.to change(ReportNote, :count).by(1)
|
expect { subject }.to change(ReportNote, :count).by(1)
|
||||||
expect(report.reload).to_not be_action_taken
|
expect(report.reload).to_not be_action_taken
|
||||||
expect(subject).to redirect_to admin_report_path(report)
|
expect(response).to redirect_to admin_report_path(report)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ describe Admin::ReportNotesController do
|
||||||
it 'creates a report note and does not unresolve report' do
|
it 'creates a report note and does not unresolve report' do
|
||||||
expect { subject }.to change(ReportNote, :count).by(1)
|
expect { subject }.to change(ReportNote, :count).by(1)
|
||||||
expect(report.reload).to be_action_taken
|
expect(report.reload).to be_action_taken
|
||||||
expect(subject).to redirect_to admin_report_path(report)
|
expect(response).to redirect_to admin_report_path(report)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -86,7 +86,7 @@ describe Admin::ReportNotesController do
|
||||||
|
|
||||||
it 'deletes note' do
|
it 'deletes note' do
|
||||||
expect { subject }.to change(ReportNote, :count).by(-1)
|
expect { subject }.to change(ReportNote, :count).by(-1)
|
||||||
expect(subject).to redirect_to admin_report_path(report_note.report)
|
expect(response).to redirect_to admin_report_path(report_note.report)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue