account_moderation_note_spec.rb 815 B

1234567891011121314151617181920212223242526
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe AccountModerationNote do
  4. describe 'Scopes' do
  5. describe '.chronological' do
  6. it 'returns account moderation notes oldest to newest' do
  7. account = Fabricate(:account)
  8. note1 = Fabricate(:account_moderation_note, target_account: account)
  9. note2 = Fabricate(:account_moderation_note, target_account: account)
  10. expect(account.targeted_moderation_notes.chronological).to eq [note1, note2]
  11. end
  12. end
  13. end
  14. describe 'Validations' do
  15. subject { Fabricate.build :account_moderation_note }
  16. describe 'content' do
  17. it { is_expected.to_not allow_value('').for(:content) }
  18. it { is_expected.to validate_length_of(:content).is_at_most(described_class::CONTENT_SIZE_LIMIT) }
  19. end
  20. end
  21. end