summaryrefslogtreecommitdiff
path: root/spec/factories/notes.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/notes.rb')
-rw-r--r--spec/factories/notes.rb36
1 files changed, 24 insertions, 12 deletions
diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb
index 5b9a7e6f864..2f02acca794 100644
--- a/spec/factories/notes.rb
+++ b/spec/factories/notes.rb
@@ -41,14 +41,14 @@ FactoryBot.define do
factory :legacy_diff_note_on_merge_request, traits: [:on_merge_request, :legacy_diff_note], class: LegacyDiffNote do
association :project, :repository
- position ''
+ position { '' }
end
factory :diff_note_on_merge_request, traits: [:on_merge_request], class: DiffNote do
association :project, :repository
transient do
- line_number 14
+ line_number { 14 }
diff_refs { noteable.try(:diff_refs) }
end
@@ -62,6 +62,18 @@ FactoryBot.define do
)
end
+ trait :folded_position do
+ position do
+ Gitlab::Diff::Position.new(
+ old_path: "files/ruby/popen.rb",
+ new_path: "files/ruby/popen.rb",
+ old_line: 1,
+ new_line: 1,
+ diff_refs: diff_refs
+ )
+ end
+ end
+
trait :resolved do
resolved_at { Time.now }
resolved_by { create(:user) }
@@ -87,7 +99,7 @@ FactoryBot.define do
association :project, :repository
transient do
- line_number 14
+ line_number { 14 }
diff_refs { project.commit(commit_id).try(:diff_refs) }
end
@@ -104,14 +116,14 @@ FactoryBot.define do
trait :on_commit do
association :project, :repository
- noteable nil
- noteable_type 'Commit'
- noteable_id nil
+ noteable { nil }
+ noteable_type { 'Commit' }
+ noteable_id { nil }
commit_id { RepoHelpers.sample_commit.id }
end
trait :legacy_diff_note do
- line_code "0_184_184"
+ line_code { "0_184_184" }
end
trait :on_issue do
@@ -132,19 +144,19 @@ FactoryBot.define do
trait :on_personal_snippet do
noteable { create(:personal_snippet) }
- project nil
+ project { nil }
end
trait :system do
- system true
+ system { true }
end
trait :downvote do
- note "thumbsdown"
+ note { "thumbsdown" }
end
trait :upvote do
- note "thumbsup"
+ note { "thumbsup" }
end
trait :with_attachment do
@@ -156,7 +168,7 @@ FactoryBot.define do
end
transient do
- in_reply_to nil
+ in_reply_to { nil }
end
before(:create) do |note, evaluator|