diff options
author | Rémy Coutable <remy@rymai.me> | 2017-01-26 09:07:08 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-01-26 09:07:08 +0000 |
commit | 37b4503125c797fbcb7b00f1e73d574dfdfa5816 (patch) | |
tree | 18125a1503810ac8d8f3ab0505fb482eaac20ebf /spec | |
parent | 3a0d9314b187ac406b33ee73d05d4f7b0e316c8b (diff) | |
parent | c1743ba4c4d838e95bed0d3e74e48a191684c4bf (diff) | |
download | gitlab-ce-37b4503125c797fbcb7b00f1e73d574dfdfa5816.tar.gz |
Merge branch 'rs-empty_project-for-associations' into 'master'
Factories with a project association use `:empty_project` by default
See merge request !8770
Diffstat (limited to 'spec')
-rw-r--r-- | spec/factories/deploy_keys_projects.rb | 2 | ||||
-rw-r--r-- | spec/factories/events.rb | 2 | ||||
-rw-r--r-- | spec/factories/file_uploader.rb | 2 | ||||
-rw-r--r-- | spec/factories/issues.rb | 2 | ||||
-rw-r--r-- | spec/factories/labels.rb | 2 | ||||
-rw-r--r-- | spec/factories/merge_requests.rb | 2 | ||||
-rw-r--r-- | spec/factories/milestones.rb | 2 | ||||
-rw-r--r-- | spec/factories/notes.rb | 14 | ||||
-rw-r--r-- | spec/factories/project_group_links.rb | 2 | ||||
-rw-r--r-- | spec/factories/project_members.rb | 2 | ||||
-rw-r--r-- | spec/factories/project_snippets.rb | 2 | ||||
-rw-r--r-- | spec/factories/releases.rb | 2 | ||||
-rw-r--r-- | spec/factories/sent_notifications.rb | 2 | ||||
-rw-r--r-- | spec/factories/services.rb | 2 | ||||
-rw-r--r-- | spec/factories/todos.rb | 2 | ||||
-rw-r--r-- | spec/models/issue_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/note_spec.rb | 2 |
17 files changed, 27 insertions, 19 deletions
diff --git a/spec/factories/deploy_keys_projects.rb b/spec/factories/deploy_keys_projects.rb index 27cece487bd..75f8982ecd9 100644 --- a/spec/factories/deploy_keys_projects.rb +++ b/spec/factories/deploy_keys_projects.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :deploy_keys_project do deploy_key - project + project factory: :empty_project end end diff --git a/spec/factories/events.rb b/spec/factories/events.rb index 8820d527c61..bfe41f71b57 100644 --- a/spec/factories/events.rb +++ b/spec/factories/events.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :event do - project + project factory: :empty_project author factory: :user factory :closed_issue_event do diff --git a/spec/factories/file_uploader.rb b/spec/factories/file_uploader.rb index 1b36e21f2b0..bc74aeecc3b 100644 --- a/spec/factories/file_uploader.rb +++ b/spec/factories/file_uploader.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :file_uploader do - project + project factory: :empty_project secret nil transient do diff --git a/spec/factories/issues.rb b/spec/factories/issues.rb index 2b4670be468..7e09f1ba8ea 100644 --- a/spec/factories/issues.rb +++ b/spec/factories/issues.rb @@ -6,7 +6,7 @@ FactoryGirl.define do factory :issue do title author - project + project factory: :empty_project trait :confidential do confidential true diff --git a/spec/factories/labels.rb b/spec/factories/labels.rb index 3e8822faf97..5ba8443c62c 100644 --- a/spec/factories/labels.rb +++ b/spec/factories/labels.rb @@ -2,7 +2,7 @@ FactoryGirl.define do factory :label, class: ProjectLabel do sequence(:title) { |n| "label#{n}" } color "#990000" - project + project factory: :empty_project transient do priority nil diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb index 37eb49c94df..22f84150bb3 100644 --- a/spec/factories/merge_requests.rb +++ b/spec/factories/merge_requests.rb @@ -2,7 +2,7 @@ FactoryGirl.define do factory :merge_request do title author - source_project factory: :project + association :source_project, :repository, factory: :project target_project { source_project } # $ git log --pretty=oneline feature..master diff --git a/spec/factories/milestones.rb b/spec/factories/milestones.rb index 84da71ed6dc..841ab3c73b8 100644 --- a/spec/factories/milestones.rb +++ b/spec/factories/milestones.rb @@ -1,7 +1,7 @@ FactoryGirl.define do factory :milestone do title - project + project factory: :empty_project trait :active do state "active" diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb index 476f2a37793..a21da7074f9 100644 --- a/spec/factories/notes.rb +++ b/spec/factories/notes.rb @@ -4,7 +4,7 @@ include ActionDispatch::TestProcess FactoryGirl.define do factory :note do - project + project factory: :empty_project note "Note" author on_issue @@ -16,10 +16,16 @@ FactoryGirl.define do factory :note_on_personal_snippet, traits: [:on_personal_snippet] factory :system_note, traits: [:system] - factory :legacy_diff_note_on_commit, traits: [:on_commit, :legacy_diff_note], class: LegacyDiffNote - factory :legacy_diff_note_on_merge_request, traits: [:on_merge_request, :legacy_diff_note], class: LegacyDiffNote + factory :legacy_diff_note_on_commit, traits: [:on_commit, :legacy_diff_note], class: LegacyDiffNote do + association :project, :repository + end + + factory :legacy_diff_note_on_merge_request, traits: [:on_merge_request, :legacy_diff_note], class: LegacyDiffNote do + association :project, :repository + end factory :diff_note_on_merge_request, traits: [:on_merge_request], class: DiffNote do + association :project, :repository position do Gitlab::Diff::Position.new( old_path: "files/ruby/popen.rb", @@ -37,6 +43,7 @@ FactoryGirl.define do end factory :diff_note_on_commit, traits: [:on_commit], class: DiffNote do + association :project, :repository position do Gitlab::Diff::Position.new( old_path: "files/ruby/popen.rb", @@ -49,6 +56,7 @@ FactoryGirl.define do end trait :on_commit do + association :project, :repository noteable nil noteable_type 'Commit' noteable_id nil diff --git a/spec/factories/project_group_links.rb b/spec/factories/project_group_links.rb index e73cc05f9d7..50341d943f5 100644 --- a/spec/factories/project_group_links.rb +++ b/spec/factories/project_group_links.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :project_group_link do - project + project factory: :empty_project group end end diff --git a/spec/factories/project_members.rb b/spec/factories/project_members.rb index c21927640d1..d62799a5a47 100644 --- a/spec/factories/project_members.rb +++ b/spec/factories/project_members.rb @@ -1,7 +1,7 @@ FactoryGirl.define do factory :project_member do user - project + project factory: :empty_project master trait(:guest) { access_level ProjectMember::GUEST } diff --git a/spec/factories/project_snippets.rb b/spec/factories/project_snippets.rb index d681a2c8483..e0fe1b36fd3 100644 --- a/spec/factories/project_snippets.rb +++ b/spec/factories/project_snippets.rb @@ -1,5 +1,5 @@ FactoryGirl.define do factory :project_snippet, parent: :snippet, class: :ProjectSnippet do - project + project factory: :empty_project end end diff --git a/spec/factories/releases.rb b/spec/factories/releases.rb index 74497dc82c0..6a6d6fa171f 100644 --- a/spec/factories/releases.rb +++ b/spec/factories/releases.rb @@ -2,6 +2,6 @@ FactoryGirl.define do factory :release do tag "v1.1.0" description "Awesome release" - project + project factory: :empty_project end end diff --git a/spec/factories/sent_notifications.rb b/spec/factories/sent_notifications.rb index 78eb929c6e7..6287c40afe9 100644 --- a/spec/factories/sent_notifications.rb +++ b/spec/factories/sent_notifications.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :sent_notification do - project + project factory: :empty_project recipient factory: :user noteable factory: :issue reply_key "0123456789abcdef" * 2 diff --git a/spec/factories/services.rb b/spec/factories/services.rb index 9de78d68280..a14a46c803e 100644 --- a/spec/factories/services.rb +++ b/spec/factories/services.rb @@ -1,5 +1,5 @@ FactoryGirl.define do factory :service do - project + project factory: :empty_project end end diff --git a/spec/factories/todos.rb b/spec/factories/todos.rb index 85a8c263643..91d6f39a5bf 100644 --- a/spec/factories/todos.rb +++ b/spec/factories/todos.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :todo do - project + project factory: :empty_project author user target factory: :issue diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index bfa36d92ac3..61d72925736 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -217,7 +217,7 @@ describe Issue, models: true do end it_behaves_like 'an editable mentionable' do - subject { create(:issue) } + subject { create(:issue, project: create(:project, :repository)) } let(:backref_text) { "issue #{subject.to_reference}" } let(:set_mentionable_text) { ->(txt){ subject.description = txt } } diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 1b8ae356f1f..6f9ae655fed 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -138,7 +138,7 @@ describe Note, models: true do it_behaves_like 'an editable mentionable' do subject { create :note, noteable: issue, project: issue.project } - let(:issue) { create :issue } + let(:issue) { create(:issue, project: create(:project, :repository)) } let(:backref_text) { issue.gfm_reference } let(:set_mentionable_text) { ->(txt) { subject.note = txt } } end |