2014-09-02 18:07:02 +05:30
|
|
|
FactoryGirl.define do
|
|
|
|
factory :merge_request do
|
2017-08-17 22:00:37 +05:30
|
|
|
title { generate(:title) }
|
2014-09-02 18:07:02 +05:30
|
|
|
author
|
2017-08-17 22:00:37 +05:30
|
|
|
association :source_project, :repository, factory: :project
|
2014-09-02 18:07:02 +05:30
|
|
|
target_project { source_project }
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
# $ git log --pretty=oneline feature..master
|
2014-09-02 18:07:02 +05:30
|
|
|
# 5937ac0a7beb003549fc5fd26fc247adbce4a52e Add submodule from gitlab.com
|
|
|
|
# 570e7b2abdd848b95f2f578043fc23bd6f6fd24d Change some files
|
|
|
|
# 6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9 More submodules
|
|
|
|
# d14d6c0abdd253381df51a723d58691b2ee1ab08 Remove ds_store files
|
|
|
|
# c1acaa58bbcbc3eafe538cb8274ba387047b69f8 Ignore DS files
|
|
|
|
#
|
|
|
|
# See also RepoHelpers.sample_compare
|
|
|
|
#
|
|
|
|
source_branch "master"
|
|
|
|
target_branch "feature"
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
merge_status "can_be_merged"
|
2014-09-02 18:07:02 +05:30
|
|
|
|
|
|
|
trait :with_diffs do
|
|
|
|
end
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
trait :without_diffs do
|
|
|
|
source_branch "improve/awesome"
|
|
|
|
target_branch "master"
|
|
|
|
end
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
trait :conflict do
|
|
|
|
source_branch "feature_conflict"
|
|
|
|
target_branch "feature"
|
|
|
|
end
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
trait :merged do
|
|
|
|
state :merged
|
|
|
|
end
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
trait :closed do
|
|
|
|
state :closed
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
trait :opened do
|
|
|
|
state :opened
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :locked do
|
|
|
|
state :locked
|
|
|
|
end
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
trait :simple do
|
|
|
|
source_branch "feature"
|
|
|
|
target_branch "master"
|
|
|
|
end
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
trait :rebased do
|
|
|
|
source_branch "markdown"
|
|
|
|
target_branch "improve/awesome"
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :diverged do
|
|
|
|
source_branch "feature"
|
|
|
|
target_branch "master"
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
trait :merge_when_pipeline_succeeds do
|
|
|
|
merge_when_pipeline_succeeds true
|
2015-12-23 02:04:40 +05:30
|
|
|
merge_user author
|
|
|
|
end
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
factory :merged_merge_request, traits: [:merged]
|
2014-09-02 18:07:02 +05:30
|
|
|
factory :closed_merge_request, traits: [:closed]
|
2017-09-10 17:25:29 +05:30
|
|
|
factory :reopened_merge_request, traits: [:opened]
|
2014-09-02 18:07:02 +05:30
|
|
|
factory :merge_request_with_diffs, traits: [:with_diffs]
|
2017-08-17 22:00:37 +05:30
|
|
|
factory :merge_request_with_diff_notes do
|
|
|
|
after(:create) do |mr|
|
|
|
|
create(:diff_note_on_merge_request, noteable: mr, project: mr.source_project)
|
|
|
|
end
|
|
|
|
end
|
2016-11-03 12:29:30 +05:30
|
|
|
|
|
|
|
factory :labeled_merge_request do
|
|
|
|
transient do
|
|
|
|
labels []
|
|
|
|
end
|
|
|
|
|
|
|
|
after(:create) do |merge_request, evaluator|
|
|
|
|
merge_request.update_attributes(labels: evaluator.labels)
|
|
|
|
end
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|