0
0
Fork 0

Convert admin/account_moderation_notes spec controller->system (#33354)

This commit is contained in:
Matt Jankowski 2024-12-19 03:02:08 -05:00 committed by GitHub
parent 85792cc375
commit 545a6b9eed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 43 additions and 57 deletions

View file

@ -0,0 +1,43 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Admin::AccountModerationNotes' do
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
let(:target_account) { Fabricate(:account) }
before { sign_in current_user }
describe 'Managing account moderation note' do
it 'saves and then deletes a record' do
visit admin_account_path(target_account.id)
fill_in 'account_moderation_note_content', with: ''
expect { submit_form }
.to not_change(AccountModerationNote, :count)
expect(page)
.to have_content(/error below/)
fill_in 'account_moderation_note_content', with: 'Test message'
expect { submit_form }
.to change(AccountModerationNote, :count).by(1)
expect(page)
.to have_content(I18n.t('admin.account_moderation_notes.created_msg'))
expect { delete_note }
.to change(AccountModerationNote, :count).by(-1)
expect(page)
.to have_content(I18n.t('admin.account_moderation_notes.destroyed_msg'))
end
def submit_form
click_on I18n.t('admin.account_moderation_notes.create')
end
def delete_note
within('.report-notes__item__actions') do
click_on I18n.t('admin.reports.notes.delete')
end
end
end
end