Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-04-26 12:11:58 +0300
committerRobert Speicher <rspeicher@gmail.com>2016-05-29 22:03:00 +0300
commitbf0b51d252e049404a49787c18e5c88071006e15 (patch)
tree80fd54ba2a0671100bbb72cc8bc76f9fb565b20e /spec/factories/notes.rb
parent87c44b0e91959439014fb8c923f3febc039d1cd0 (diff)
Update note factory to include noteable association
Diffstat (limited to 'spec/factories/notes.rb')
-rw-r--r--spec/factories/notes.rb18
1 files changed, 6 insertions, 12 deletions
diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb
index 26719f2652c..7e9378ab625 100644
--- a/spec/factories/notes.rb
+++ b/spec/factories/notes.rb
@@ -4,13 +4,14 @@ include ActionDispatch::TestProcess
FactoryGirl.define do
factory :note do
- project
note "Note"
author
+ noteable { create(:issue) }
+ project { noteable.project }
+ factory :note_on_issue, aliases: [:votable_note]
factory :note_on_commit, traits: [:on_commit]
factory :note_on_commit_diff, traits: [:on_commit, :on_diff], class: LegacyDiffNote
- factory :note_on_issue, traits: [:on_issue], aliases: [:votable_note]
factory :note_on_merge_request, traits: [:on_merge_request]
factory :note_on_merge_request_diff, traits: [:on_merge_request, :on_diff], class: LegacyDiffNote
factory :note_on_project_snippet, traits: [:on_project_snippet]
@@ -20,6 +21,7 @@ FactoryGirl.define do
trait :on_commit do
project
+ noteable nil
commit_id RepoHelpers.sample_commit.id
noteable_type "Commit"
end
@@ -29,19 +31,11 @@ FactoryGirl.define do
end
trait :on_merge_request do
- project
- noteable_id 1
- noteable_type "MergeRequest"
- end
-
- trait :on_issue do
- noteable_id 1
- noteable_type "Issue"
+ noteable { create(:merge_request) }
end
trait :on_project_snippet do
- noteable_id 1
- noteable_type "Snippet"
+ noteable { create(:snippet) }
end
trait :system do