2014-08-25 05:25:02 -04:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: notes
|
|
|
|
#
|
|
|
|
# id :integer not null, primary key
|
|
|
|
# note :text
|
|
|
|
# noteable_type :string(255)
|
|
|
|
# author_id :integer
|
|
|
|
# created_at :datetime
|
|
|
|
# updated_at :datetime
|
|
|
|
# project_id :integer
|
|
|
|
# attachment :string(255)
|
|
|
|
# line_code :string(255)
|
|
|
|
# commit_id :string(255)
|
|
|
|
# noteable_id :integer
|
|
|
|
# system :boolean default(FALSE), not null
|
|
|
|
# st_diff :text
|
2015-09-06 10:48:48 -04:00
|
|
|
# updated_by_id :integer
|
2014-08-25 05:25:02 -04:00
|
|
|
#
|
|
|
|
|
2014-08-01 10:54:44 -04:00
|
|
|
require_relative '../support/repo_helpers'
|
|
|
|
|
|
|
|
FactoryGirl.define do
|
|
|
|
factory :note do
|
|
|
|
project
|
|
|
|
note "Note"
|
|
|
|
author
|
|
|
|
|
2015-04-30 23:16:19 -04:00
|
|
|
factory :note_on_commit, traits: [:on_commit]
|
|
|
|
factory :note_on_commit_diff, traits: [:on_commit, :on_diff]
|
|
|
|
factory :note_on_issue, traits: [:on_issue], aliases: [:votable_note]
|
|
|
|
factory :note_on_merge_request, traits: [:on_merge_request]
|
2014-08-01 10:54:44 -04:00
|
|
|
factory :note_on_merge_request_diff, traits: [:on_merge_request, :on_diff]
|
2015-04-30 23:16:19 -04:00
|
|
|
factory :note_on_project_snippet, traits: [:on_project_snippet]
|
|
|
|
factory :system_note, traits: [:system]
|
2014-08-01 10:54:44 -04:00
|
|
|
|
|
|
|
trait :on_commit do
|
2015-05-10 22:57:44 -04:00
|
|
|
project
|
2014-08-01 10:54:44 -04:00
|
|
|
commit_id RepoHelpers.sample_commit.id
|
|
|
|
noteable_type "Commit"
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :on_diff do
|
|
|
|
line_code "0_184_184"
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :on_merge_request do
|
2015-05-10 22:57:44 -04:00
|
|
|
project
|
2014-08-01 10:54:44 -04:00
|
|
|
noteable_id 1
|
|
|
|
noteable_type "MergeRequest"
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :on_issue do
|
|
|
|
noteable_id 1
|
|
|
|
noteable_type "Issue"
|
|
|
|
end
|
|
|
|
|
2015-03-05 13:38:23 -05:00
|
|
|
trait :on_project_snippet do
|
|
|
|
noteable_id 1
|
|
|
|
noteable_type "Snippet"
|
|
|
|
end
|
|
|
|
|
2015-04-30 23:16:19 -04:00
|
|
|
trait :system do
|
|
|
|
system true
|
|
|
|
end
|
|
|
|
|
2014-08-01 10:54:44 -04:00
|
|
|
trait :with_attachment do
|
|
|
|
attachment { fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "`/png") }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|