2019-03-30 03:23:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-03-15 09:18:44 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-07-10 10:24:02 -04:00
|
|
|
describe SystemNoteMetadata do
|
2017-03-15 09:18:44 -04:00
|
|
|
describe 'associations' do
|
|
|
|
it { is_expected.to belong_to(:note) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'validation' do
|
|
|
|
it { is_expected.to validate_presence_of(:note) }
|
|
|
|
|
2017-03-15 09:19:45 -04:00
|
|
|
context 'when action type is invalid' do
|
2017-03-15 09:18:44 -04:00
|
|
|
subject do
|
2017-03-15 09:19:45 -04:00
|
|
|
build(:system_note_metadata, note: build(:note), action: 'invalid_type' )
|
2017-03-15 09:18:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be_invalid }
|
|
|
|
end
|
|
|
|
|
2017-03-15 09:19:45 -04:00
|
|
|
context 'when action type is valid' do
|
2017-03-15 09:18:44 -04:00
|
|
|
subject do
|
2017-03-15 09:19:45 -04:00
|
|
|
build(:system_note_metadata, note: build(:note), action: 'merge' )
|
2017-03-15 09:18:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be_valid }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|