Commit 2c9e5d45 authored by Brett Walker's avatar Brett Walker

Change `group` association to `namespace`

This is more accurate, as it can reference a
top-level namespace.
parent baddf97e
......@@ -13,7 +13,7 @@ class WorkItem::Type < ApplicationRecord
enum base_type: Issue.issue_types
belongs_to :group, foreign_key: :namespace_id, optional: true
belongs_to :namespace, optional: true
has_many :work_items, class_name: 'Issue', foreign_key: :work_item_type_id, inverse_of: :work_item_type
before_validation :strip_whitespace
......
......@@ -2,10 +2,14 @@
FactoryBot.define do
factory :work_item_type, class: 'WorkItem::Type' do
group
namespace
name { generate(:work_item_type_name) }
icon_name { 'issue' }
base_type { Issue.issue_types['issue'] }
trait :default do
namespace { nil }
end
end
end
......@@ -9,7 +9,7 @@ RSpec.describe WorkItem::Type do
describe 'associations' do
it { is_expected.to have_many(:work_items).with_foreign_key('work_item_type_id') }
it { is_expected.to belong_to(:group).with_foreign_key('namespace_id') }
it { is_expected.to belong_to(:namespace) }
end
describe '#destroy' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment