debian-mirror-gitlab/spec/models/system_note_metadata_spec.rb

39 lines
900 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.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
2021-02-22 17:27:13 +05:30
build(:system_note_metadata, note: build(:note), action: 'invalid_type')
2017-08-17 22:00:37 +05:30
end
it { is_expected.to be_invalid }
end
context 'when action type is valid' do
subject do
2021-02-22 17:27:13 +05:30
build(:system_note_metadata, note: build(:note), action: 'merge')
end
it { is_expected.to be_valid }
end
context 'when importing' do
subject do
build(:system_note_metadata, note: nil, action: 'merge', importing: true)
2017-08-17 22:00:37 +05:30
end
it { is_expected.to be_valid }
end
end
end