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

30 lines
650 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) }
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