diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-03-13 16:13:12 -0600 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-04-05 17:44:14 +0100 |
commit | 9c30b0e918ca035d8555de5e3393247f6d00ed16 (patch) | |
tree | 7aeea9695748036cf465952711184f2469427fab /spec/factories/notes.rb | |
parent | 336016fa858dfa48b9f9e9b5b2d9c3a9000fffe5 (diff) | |
download | gitlab-ce-9c30b0e918ca035d8555de5e3393247f6d00ed16.tar.gz |
Fix some specs
Diffstat (limited to 'spec/factories/notes.rb')
-rw-r--r-- | spec/factories/notes.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb index 755c6d7e031..0ad7034e96d 100644 --- a/spec/factories/notes.rb +++ b/spec/factories/notes.rb @@ -18,7 +18,7 @@ FactoryGirl.define do factory :discussion_note_on_merge_request, traits: [:on_merge_request], class: DiscussionNote do association :project, :repository - + trait :resolved do resolved_at { Time.now } resolved_by { create(:user) } @@ -117,5 +117,18 @@ FactoryGirl.define do trait :with_svg_attachment do attachment { fixture_file_upload(Rails.root + "spec/fixtures/unsanitized.svg", "image/svg+xml") } end + + transient do + in_reply_to nil + end + + before(:create) do |note, evaluator| + discussion = evaluator.in_reply_to + next unless discussion + discussion = discussion.to_discussion if discussion.is_a?(Note) + next unless discussion + + note.assign_attributes(discussion.reply_attributes) + end end end |