system_note_metadata_spec.rb 619 Bytes
Newer Older
1 2
require 'spec_helper'

3
describe SystemNoteMetadata do
4 5 6 7 8 9 10
  describe 'associations' do
    it { is_expected.to belong_to(:note) }
  end

  describe 'validation' do
    it { is_expected.to validate_presence_of(:note) }

11
    context 'when action type is invalid' do
12
      subject do
13
        build(:system_note_metadata, note: build(:note), action: 'invalid_type' )
14 15 16 17 18
      end

      it { is_expected.to be_invalid }
    end

19
    context 'when action type is valid' do
20
      subject do
21
        build(:system_note_metadata, note: build(:note), action: 'merge' )
22 23 24 25 26 27
      end

      it { is_expected.to be_valid }
    end
  end
end