2014-09-02 18:07:02 +05:30
|
|
|
require_relative '../support/repo_helpers'
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
include ActionDispatch::TestProcess
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
FactoryGirl.define do
|
|
|
|
factory :note do
|
|
|
|
project
|
|
|
|
note "Note"
|
|
|
|
author
|
2016-06-16 23:09:34 +05:30
|
|
|
on_issue
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
factory :note_on_commit, traits: [:on_commit]
|
2016-06-02 11:05:42 +05:30
|
|
|
factory :note_on_commit_diff, traits: [:on_commit, :on_diff], class: LegacyDiffNote
|
2015-09-11 14:41:01 +05:30
|
|
|
factory :note_on_issue, traits: [:on_issue], aliases: [:votable_note]
|
|
|
|
factory :note_on_merge_request, traits: [:on_merge_request]
|
2016-06-02 11:05:42 +05:30
|
|
|
factory :note_on_merge_request_diff, traits: [:on_merge_request, :on_diff], class: LegacyDiffNote
|
2015-09-11 14:41:01 +05:30
|
|
|
factory :note_on_project_snippet, traits: [:on_project_snippet]
|
|
|
|
factory :system_note, traits: [:system]
|
2014-09-02 18:07:02 +05:30
|
|
|
|
|
|
|
trait :on_commit do
|
2016-06-16 23:09:34 +05:30
|
|
|
noteable nil
|
|
|
|
noteable_id nil
|
|
|
|
noteable_type 'Commit'
|
2014-09-02 18:07:02 +05:30
|
|
|
commit_id RepoHelpers.sample_commit.id
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :on_diff do
|
|
|
|
line_code "0_184_184"
|
|
|
|
end
|
|
|
|
|
2016-06-16 23:09:34 +05:30
|
|
|
trait :on_issue do
|
|
|
|
noteable { create(:issue, project: project) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2016-06-16 23:09:34 +05:30
|
|
|
trait :on_merge_request do
|
|
|
|
noteable { create(:merge_request, source_project: project) }
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
trait :on_project_snippet do
|
2016-06-16 23:09:34 +05:30
|
|
|
noteable { create(:snippet, project: project) }
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
trait :system do
|
|
|
|
system true
|
|
|
|
end
|
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
trait :downvote do
|
|
|
|
note "thumbsdown"
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :upvote do
|
|
|
|
note "thumbsup"
|
|
|
|
end
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
trait :with_attachment do
|
|
|
|
attachment { fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "`/png") }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|