1
0

report_note_spec.rb 715 B

1234567891011121314151617181920212223242526
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe ReportNote do
  4. describe 'Scopes' do
  5. describe '.chronological' do
  6. it 'returns report notes oldest to newest' do
  7. report = Fabricate(:report)
  8. note1 = Fabricate(:report_note, report: report)
  9. note2 = Fabricate(:report_note, report: report)
  10. expect(report.notes.chronological).to eq [note1, note2]
  11. end
  12. end
  13. end
  14. describe 'Validations' do
  15. subject { Fabricate.build :report_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