Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/work_item_spec.rb')
-rw-r--r--spec/models/work_item_spec.rb31
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