diff options
Diffstat (limited to 'spec/factories/work_items.rb')
-rw-r--r-- | spec/factories/work_items.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/factories/work_items.rb b/spec/factories/work_items.rb index cff246d4071..10764457d84 100644 --- a/spec/factories/work_items.rb +++ b/spec/factories/work_items.rb @@ -14,6 +14,19 @@ FactoryBot.define do confidential { true } end + trait :opened do + state_id { WorkItem.available_states[:opened] } + end + + trait :locked do + discussion_locked { true } + end + + trait :closed do + state_id { WorkItem.available_states[:closed] } + closed_at { Time.now } + end + trait :task do issue_type { :task } association :work_item_type, :default, :task @@ -24,6 +37,16 @@ FactoryBot.define do association :work_item_type, :default, :incident end + trait :requirement do + issue_type { :requirement } + association :work_item_type, :default, :requirement + end + + trait :test_case do + issue_type { :test_case } + association :work_item_type, :default, :test_case + end + trait :last_edited_by_user do association :last_edited_by, factory: :user end @@ -37,5 +60,12 @@ FactoryBot.define do issue_type { :key_result } association :work_item_type, :default, :key_result end + + before(:create, :build) do |work_item, evaluator| + if evaluator.namespace.present? + work_item.project = nil + work_item.namespace = evaluator.namespace + end + end end end |