diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-03-17 22:25:52 +0300 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-04-05 19:44:14 +0300 |
commit | 79889a6aa3dc878d196d0f2f445ab6b10ef10c74 (patch) | |
tree | 25367a69b4a529335e106d0d65c2d9a38e97f092 /spec/factories/notes.rb | |
parent | 80b2e18fb62b8da7410f90b3e5340b9e63e765a3 (diff) |
Add specs
Diffstat (limited to 'spec/factories/notes.rb')
-rw-r--r-- | spec/factories/notes.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb index 0ad7034e96d..0f9056a4914 100644 --- a/spec/factories/notes.rb +++ b/spec/factories/notes.rb @@ -25,6 +25,14 @@ FactoryGirl.define do end end + factory :discussion_note_on_issue, traits: [:on_issue], class: DiscussionNote do + association :project, :repository + end + + factory :discussion_note_on_commit, traits: [:on_commit], class: DiscussionNote do + association :project, :repository + end + factory :legacy_diff_note_on_commit, traits: [:on_commit, :legacy_diff_note], class: LegacyDiffNote do association :project, :repository end @@ -46,7 +54,7 @@ FactoryGirl.define do new_path: "files/ruby/popen.rb", old_line: nil, new_line: line_number, - diff_refs: noteable.diff_refs + diff_refs: noteable.try(:diff_refs) ) end @@ -127,8 +135,8 @@ FactoryGirl.define do next unless discussion discussion = discussion.to_discussion if discussion.is_a?(Note) next unless discussion - - note.assign_attributes(discussion.reply_attributes) + + note.assign_attributes(discussion.reply_attributes.merge(project: discussion.project)) end end end |