gitlab-org--gitlab-foss/spec/models/system_note_metadata_spec.rb

31 lines
708 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-03-15 09:18:44 -04:00
require 'spec_helper'
describe SystemNoteMetadata do
2017-03-15 09:18:44 -04:00
describe 'associations' do
it { is_expected.to belong_to(:note) }
it { is_expected.to belong_to(:description_version) }
2017-03-15 09:18:44 -04:00
end
describe 'validation' do
it { is_expected.to validate_presence_of(:note) }
context 'when action type is invalid' do
2017-03-15 09:18:44 -04:00
subject do
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
context 'when action type is valid' do
2017-03-15 09:18:44 -04:00
subject do
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