Commit 56ae036e authored by Robert Speicher's avatar Robert Speicher

Use `empty_project` where possible in spec/features/merge_requests

parent 293ad11d
...@@ -2,7 +2,7 @@ require 'rails_helper' ...@@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Merge request issue assignment', js: true do feature 'Merge request issue assignment', js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:issue1) { create(:issue, project: project) } let(:issue1) { create(:issue, project: project) }
let(:issue2) { create(:issue, project: project) } let(:issue2) { create(:issue, project: project) }
let(:merge_request) { create(:merge_request, :simple, source_project: project, author: user, description: "fixes #{issue1.to_reference} and #{issue2.to_reference}") } let(:merge_request) { create(:merge_request, :simple, source_project: project, author: user, description: "fixes #{issue1.to_reference} and #{issue2.to_reference}") }
......
...@@ -2,7 +2,7 @@ require 'rails_helper' ...@@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Merge request awards', js: true do feature 'Merge request awards', js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
describe 'logged in' do describe 'logged in' do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Check if mergeable with unresolved discussions', js: true do feature 'Check if mergeable with unresolved discussions', js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let!(:merge_request) { create(:merge_request_with_diff_notes, source_project: project, author: user) } let!(:merge_request) { create(:merge_request_with_diff_notes, source_project: project, author: user) }
before do before do
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe 'Cherry-pick Merge Requests', js: true do describe 'Cherry-pick Merge Requests', js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:group) { create(:group) } let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) } let(:project) { create(:project, :repository, namespace: group) }
let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user) } let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user) }
before do before do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Merge Request closing issues message', js: true do feature 'Merge Request closing issues message', js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:issue_1) { create(:issue, project: project)} let(:issue_1) { create(:issue, project: project)}
let(:issue_2) { create(:issue, project: project)} let(:issue_2) { create(:issue, project: project)}
let(:merge_request) do let(:merge_request) do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Merge request conflict resolution', js: true do feature 'Merge request conflict resolution', js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
before do before do
# In order to have the diffs collapsed, we need to disable the increase feature # In order to have the diffs collapsed, we need to disable the increase feature
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Create New Merge Request', js: true do feature 'Create New Merge Request', js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
before do before do
project.team << [user, :master] project.team << [user, :master]
...@@ -63,7 +63,7 @@ feature 'Create New Merge Request', js: true do ...@@ -63,7 +63,7 @@ feature 'Create New Merge Request', js: true do
context 'when target project cannot be viewed by the current user' do context 'when target project cannot be viewed by the current user' do
it 'does not leak the private project name & namespace' do it 'does not leak the private project name & namespace' do
private_project = create(:project, :private) private_project = create(:project, :private, :repository)
visit project_new_merge_request_path(project, merge_request: { target_project_id: private_project.id }) visit project_new_merge_request_path(project, merge_request: { target_project_id: private_project.id })
...@@ -74,7 +74,7 @@ feature 'Create New Merge Request', js: true do ...@@ -74,7 +74,7 @@ feature 'Create New Merge Request', js: true do
context 'when source project cannot be viewed by the current user' do context 'when source project cannot be viewed by the current user' do
it 'does not leak the private project name & namespace' do it 'does not leak the private project name & namespace' do
private_project = create(:project, :private) private_project = create(:project, :private, :repository)
visit project_new_merge_request_path(project, merge_request: { source_project_id: private_project.id }) visit project_new_merge_request_path(project, merge_request: { source_project_id: private_project.id })
......
...@@ -2,8 +2,8 @@ require 'spec_helper' ...@@ -2,8 +2,8 @@ require 'spec_helper'
feature 'Merge request created from fork' do feature 'Merge request created from fork' do
given(:user) { create(:user) } given(:user) { create(:user) }
given(:project) { create(:project, :public) } given(:project) { create(:project, :public, :repository) }
given(:fork_project) { create(:project, :public) } given(:fork_project) { create(:project, :public, :repository) }
given!(:merge_request) do given!(:merge_request) do
create(:forked_project_link, forked_to_project: fork_project, create(:forked_project_link, forked_to_project: fork_project,
......
...@@ -4,7 +4,7 @@ feature 'Diff note avatars', js: true do ...@@ -4,7 +4,7 @@ feature 'Diff note avatars', js: true do
include NoteInteractionHelpers include NoteInteractionHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user, title: "Bug NS-04") } let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user, title: "Bug NS-04") }
let(:path) { "files/ruby/popen.rb" } let(:path) { "files/ruby/popen.rb" }
let(:position) do let(:position) do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Diff notes resolve', js: true do feature 'Diff notes resolve', js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user, title: "Bug NS-04") } let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user, title: "Bug NS-04") }
let!(:note) { create(:diff_note_on_merge_request, project: project, noteable: merge_request) } let!(:note) { create(:diff_note_on_merge_request, project: project, noteable: merge_request) }
let(:path) { "files/ruby/popen.rb" } let(:path) { "files/ruby/popen.rb" }
......
require 'spec_helper' require 'spec_helper'
feature 'Diffs URL', js: true do feature 'Diffs URL', js: true do
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
context 'when visit with */* as accept header' do context 'when visit with */* as accept header' do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Edit Merge Request' do feature 'Edit Merge Request' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, :simple, source_project: project) } let(:merge_request) { create(:merge_request, :simple, source_project: project) }
before do before do
......
require 'rails_helper' require 'rails_helper'
feature 'Issue filtering by Labels', js: true do feature 'Merge Request filtering by Labels', js: true do
include FilteredSearchHelpers include FilteredSearchHelpers
include MergeRequestHelpers include MergeRequestHelpers
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let!(:user) { create(:user) } let!(:user) { create(:user) }
let!(:label) { create(:label, project: project) } let!(:label) { create(:label, project: project) }
......
...@@ -4,7 +4,7 @@ feature 'Merge Request filtering by Milestone' do ...@@ -4,7 +4,7 @@ feature 'Merge Request filtering by Milestone' do
include FilteredSearchHelpers include FilteredSearchHelpers
include MergeRequestHelpers include MergeRequestHelpers
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let!(:user) { create(:user)} let!(:user) { create(:user)}
let(:milestone) { create(:milestone, project: project) } let(:milestone) { create(:milestone, project: project) }
......
...@@ -4,7 +4,7 @@ describe 'Filter merge requests' do ...@@ -4,7 +4,7 @@ describe 'Filter merge requests' do
include FilteredSearchHelpers include FilteredSearchHelpers
include MergeRequestHelpers include MergeRequestHelpers
let!(:project) { create(:project) } let!(:project) { create(:project, :repository) }
let!(:group) { create(:group) } let!(:group) { create(:group) }
let!(:user) { create(:user) } let!(:user) { create(:user) }
let!(:milestone) { create(:milestone, project: project) } let!(:milestone) { create(:milestone, project: project) }
......
require 'rails_helper' require 'rails_helper'
describe 'New/edit merge request', :js do describe 'New/edit merge request', :js do
let!(:project) { create(:project, visibility_level: Gitlab::VisibilityLevel::PUBLIC) } let!(:project) { create(:project, :public, :repository) }
let(:fork_project) { create(:project, forked_from_project: project) } let(:fork_project) { create(:project, :repository, forked_from_project: project) }
let!(:user) { create(:user)} let!(:user) { create(:user) }
let!(:user2) { create(:user)} let!(:user2) { create(:user) }
let!(:milestone) { create(:milestone, project: project) } let!(:milestone) { create(:milestone, project: project) }
let!(:label) { create(:label, project: project) } let!(:label) { create(:label, project: project) }
let!(:label2) { create(:label, project: project) } let!(:label2) { create(:label, project: project) }
before do before do
project.team << [user, :master] project.team << [user, :master]
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Clicking toggle commit message link', js: true do feature 'Clicking toggle commit message link', js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:issue_1) { create(:issue, project: project)} let(:issue_1) { create(:issue, project: project)}
let(:issue_2) { create(:issue, project: project)} let(:issue_2) { create(:issue, project: project)}
let(:merge_request) do let(:merge_request) do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Merge immediately', :js do feature 'Merge immediately', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let!(:merge_request) do let!(:merge_request) do
create(:merge_request_with_diffs, source_project: project, create(:merge_request_with_diffs, source_project: project,
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Merge When Pipeline Succeeds', :js do feature 'Merge When Pipeline Succeeds', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:merge_request) do let(:merge_request) do
create(:merge_request_with_diffs, source_project: project, create(:merge_request_with_diffs, source_project: project,
......
...@@ -2,7 +2,7 @@ require 'rails_helper' ...@@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Mini Pipeline Graph', :js do feature 'Mini Pipeline Graph', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, source_project: project, head_pipeline: pipeline) } let(:merge_request) { create(:merge_request, source_project: project, head_pipeline: pipeline) }
let(:pipeline) { create(:ci_empty_pipeline, project: project, ref: 'master', status: 'running', sha: project.commit.id) } let(:pipeline) { create(:ci_empty_pipeline, project: project, ref: 'master', status: 'running', sha: project.commit.id) }
......
...@@ -5,7 +5,7 @@ feature 'Merge requests filter clear button', js: true do ...@@ -5,7 +5,7 @@ feature 'Merge requests filter clear button', js: true do
include MergeRequestHelpers include MergeRequestHelpers
include IssueHelpers include IssueHelpers
let!(:project) { create(:project, :public) } let!(:project) { create(:project, :public, :repository) }
let!(:user) { create(:user) } let!(:user) { create(:user) }
let!(:milestone) { create(:milestone, project: project) } let!(:milestone) { create(:milestone, project: project) }
let!(:bug) { create(:label, project: project, name: 'bug')} let!(:bug) { create(:label, project: project, name: 'bug')}
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'toggler_behavior', js: true do feature 'toggler_behavior', js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project, author: user) } let(:merge_request) { create(:merge_request, source_project: project, author: user) }
let(:note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project) } let(:note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project) }
let(:fragment_id) { "#note_#{note.id}" } let(:fragment_id) { "#note_#{note.id}" }
......
...@@ -2,7 +2,7 @@ require 'rails_helper' ...@@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Multiple merge requests updating from merge_requests#index' do feature 'Multiple merge requests updating from merge_requests#index' do
let!(:user) { create(:user)} let!(:user) { create(:user)}
let!(:project) { create(:project) } let!(:project) { create(:project, :repository) }
let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) } let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
before do before do
......
...@@ -4,7 +4,7 @@ describe 'Projects > Merge requests > User lists merge requests' do ...@@ -4,7 +4,7 @@ describe 'Projects > Merge requests > User lists merge requests' do
include MergeRequestHelpers include MergeRequestHelpers
include SortingHelper include SortingHelper
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe 'Merge requests > User posts notes', :js do describe 'Merge requests > User posts notes', :js do
include NoteInteractionHelpers include NoteInteractionHelpers
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:merge_request) do let(:merge_request) do
create(:merge_request, source_project: project, target_project: project) create(:merge_request, source_project: project, target_project: project)
end end
......
require 'spec_helper' require 'spec_helper'
feature 'Merge requests > User sees system notes' do feature 'Merge requests > User sees system notes' do
let(:public_project) { create(:project, :public) } let(:public_project) { create(:project, :public, :repository) }
let(:private_project) { create(:project, :private) } let(:private_project) { create(:project, :private, :repository) }
let(:issue) { create(:issue, project: private_project) } let(:issue) { create(:issue, project: private_project) }
let(:merge_request) { create(:merge_request, source_project: public_project, source_branch: 'markdown') } let(:merge_request) { create(:merge_request, source_project: public_project, source_branch: 'markdown') }
let!(:note) { create(:note_on_merge_request, :system, noteable: merge_request, project: public_project, note: "mentioned in #{issue.to_reference(public_project)}") } let!(:note) { create(:note_on_merge_request, :system, noteable: merge_request, project: public_project, note: "mentioned in #{issue.to_reference(public_project)}") }
......
...@@ -4,7 +4,7 @@ feature 'Merge Requests > User uses quick actions', js: true do ...@@ -4,7 +4,7 @@ feature 'Merge Requests > User uses quick actions', js: true do
include QuickActionsHelpers include QuickActionsHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
let!(:milestone) { create(:milestone, project: project, title: 'ASAP') } let!(:milestone) { create(:milestone, project: project, title: 'ASAP') }
...@@ -129,7 +129,7 @@ feature 'Merge Requests > User uses quick actions', js: true do ...@@ -129,7 +129,7 @@ feature 'Merge Requests > User uses quick actions', js: true do
end end
describe '/target_branch command in merge request' do describe '/target_branch command in merge request' do
let(:another_project) { create(:project, :public) } let(:another_project) { create(:project, :public, :repository) }
let(:new_url_opts) { { merge_request: { source_branch: 'feature' } } } let(:new_url_opts) { { merge_request: { source_branch: 'feature' } } }
before do before do
......
...@@ -2,7 +2,7 @@ require 'rails_helper' ...@@ -2,7 +2,7 @@ require 'rails_helper'
describe 'Merge request', :js do describe 'Merge request', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
before do before do
...@@ -200,7 +200,7 @@ describe 'Merge request', :js do ...@@ -200,7 +200,7 @@ describe 'Merge request', :js do
end end
context 'user can merge into source project but cannot push to fork', js: true do context 'user can merge into source project but cannot push to fork', js: true do
let(:fork_project) { create(:project, :public) } let(:fork_project) { create(:project, :public, :repository) }
let(:user2) { create(:user) } let(:user2) { create(:user) }
before do before do
......
require 'spec_helper' require 'spec_helper'
feature 'Work In Progress help message' do feature 'Work In Progress help message' do
let!(:project) { create(:project, visibility_level: Gitlab::VisibilityLevel::PUBLIC) } let!(:project) { create(:project, :public, :repository) }
let!(:user) { create(:user) } let!(:user) { create(:user) }
before do before do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment