diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/models/work_item_spec.rb | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/models/work_item_spec.rb')
-rw-r--r-- | spec/models/work_item_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/models/work_item_spec.rb b/spec/models/work_item_spec.rb index e92ae746911..5e757c11f99 100644 --- a/spec/models/work_item_spec.rb +++ b/spec/models/work_item_spec.rb @@ -3,6 +3,28 @@ require 'spec_helper' RSpec.describe WorkItem do + describe 'associations' do + it { is_expected.to have_one(:work_item_parent).class_name('WorkItem') } + + it 'has one `parent_link`' do + is_expected.to have_one(:parent_link) + .class_name('::WorkItems::ParentLink') + .with_foreign_key('work_item_id') + end + + it 'has many `work_item_children`' do + is_expected.to have_many(:work_item_children) + .class_name('WorkItem') + .with_foreign_key('work_item_id') + end + + it 'has many `child_links`' do + is_expected.to have_many(:child_links) + .class_name('::WorkItems::ParentLink') + .with_foreign_key('work_item_parent_id') + end + end + describe '#noteable_target_type_name' do it 'returns `issue` as the target name' do work_item = build(:work_item) @@ -11,6 +33,15 @@ RSpec.describe WorkItem do end end + describe '#widgets' do + subject { build(:work_item).widgets } + + it 'returns instances of supported widgets' do + is_expected.to match_array([instance_of(WorkItems::Widgets::Description), + instance_of(WorkItems::Widgets::Hierarchy)]) + end + end + describe 'callbacks' do describe 'record_create_action' do it 'records the creation action after saving' do |