2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
describe SystemNoteMetadata do
|
2017-08-17 22:00:37 +05:30
|
|
|
describe 'associations' do
|
|
|
|
it { is_expected.to belong_to(:note) }
|
2019-12-21 20:55:43 +05:30
|
|
|
it { is_expected.to belong_to(:description_version) }
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe 'validation' do
|
|
|
|
it { is_expected.to validate_presence_of(:note) }
|
|
|
|
|
|
|
|
context 'when action type is invalid' do
|
|
|
|
subject do
|
|
|
|
build(:system_note_metadata, note: build(:note), action: 'invalid_type' )
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be_invalid }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when action type is valid' do
|
|
|
|
subject do
|
|
|
|
build(:system_note_metadata, note: build(:note), action: 'merge' )
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be_valid }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|