summaryrefslogtreecommitdiff
path: root/spec/factories/notes.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-04 06:10:10 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-04 06:10:10 +0000
commit2fa68d3a97fd31bf469050e130f0fc95e8944316 (patch)
tree5c00585c55c44917765c152426cb58c803b4f57f /spec/factories/notes.rb
parent21be9646a94e2c145897e25d9c521523d55e1614 (diff)
downloadgitlab-ce-2fa68d3a97fd31bf469050e130f0fc95e8944316.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/factories/notes.rb')
-rw-r--r--spec/factories/notes.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb
index fdd1a9a18b2..0868e38f70e 100644
--- a/spec/factories/notes.rb
+++ b/spec/factories/notes.rb
@@ -107,6 +107,10 @@ FactoryBot.define do
end
end
+ factory :diff_note_on_design, parent: :note, traits: [:on_design], class: 'DiffNote' do
+ position { build(:image_diff_position, file: noteable.full_path, diff_refs: noteable.diff_refs) }
+ end
+
trait :on_commit do
association :project, :repository
noteable { nil }
@@ -136,6 +140,20 @@ FactoryBot.define do
project { nil }
end
+ trait :on_design do
+ transient do
+ issue { association(:issue, project: project) }
+ end
+ noteable { association(:design, :with_file, issue: issue) }
+
+ after(:build) do |note|
+ next if note.project == note.noteable.project
+
+ # note validations require consistency between these two objects
+ note.project = note.noteable.project
+ end
+ end
+
trait :system do
system { true }
end