Commit 8e6dabb0 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'rs-empty-project-features' into 'master'

Use `:empty_project` where possible in top-level feature specs

See merge request !10836
parents 7e335d20 aef34502
...@@ -4,7 +4,7 @@ describe 'Auto deploy' do ...@@ -4,7 +4,7 @@ describe 'Auto deploy' do
include WaitForAjax include WaitForAjax
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
before do before do
project.create_kubernetes_service( project.create_kubernetes_service(
......
...@@ -4,7 +4,7 @@ feature 'Contributions Calendar', :feature, :js do ...@@ -4,7 +4,7 @@ feature 'Contributions Calendar', :feature, :js do
include WaitForAjax include WaitForAjax
let(:user) { create(:user) } let(:user) { create(:user) }
let(:contributed_project) { create(:project, :public) } let(:contributed_project) { create(:empty_project, :public) }
let(:issue_note) { create(:note, project: contributed_project) } let(:issue_note) { create(:note, project: contributed_project) }
# Ex/ Sunday Jan 1, 2016 # Ex/ Sunday Jan 1, 2016
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe 'Commits' do describe 'Commits' do
include CiStatusHelper include CiStatusHelper
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
describe 'CI' do describe 'CI' do
before do before do
......
...@@ -433,7 +433,7 @@ describe 'Copy as GFM', feature: true, js: true do ...@@ -433,7 +433,7 @@ describe 'Copy as GFM', feature: true, js: true do
end end
describe 'Copying code' do describe 'Copying code' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
context 'from a diff' do context 'from a diff' do
before do before do
......
...@@ -5,7 +5,7 @@ feature 'Cycle Analytics', feature: true, js: true do ...@@ -5,7 +5,7 @@ feature 'Cycle Analytics', feature: true, js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:guest) { create(:user) } let(:guest) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:issue) { create(:issue, project: project, created_at: 2.days.ago) } let(:issue) { create(:issue, project: project, created_at: 2.days.ago) }
let(:milestone) { create(:milestone, project: project) } let(:milestone) { create(:milestone, project: project) }
let(:mr) { create_merge_request_closing_issue(issue) } let(:mr) { create_merge_request_closing_issue(issue) }
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe "Dashboard Issues filtering", feature: true, js: true do describe "Dashboard Issues filtering", feature: true, js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:milestone) { create(:milestone, project: project) } let(:milestone) { create(:milestone, project: project) }
context 'filtering by milestone' do context 'filtering by milestone' do
......
...@@ -4,7 +4,7 @@ feature 'Expand and collapse diffs', js: true, feature: true do ...@@ -4,7 +4,7 @@ feature 'Expand and collapse diffs', js: true, feature: true do
include WaitForAjax include WaitForAjax
let(:branch) { 'expand-collapse-diffs' } let(:branch) { 'expand-collapse-diffs' }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
before do before do
login_as :admin login_as :admin
......
require 'spec_helper' require 'spec_helper'
describe "GitLab Flavored Markdown", feature: true do describe "GitLab Flavored Markdown", feature: true do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
let(:fred) do let(:fred) do
u = create(:user, name: "fred") create(:user, name: 'fred') do |user|
project.team << [u, :master] project.add_master(user)
u end
end end
before do before do
allow_any_instance_of(Commit).to receive(:title). login_as(:user)
and_return("fix #{issue.to_reference}\n\nask #{fred.to_reference} for details") project.add_developer(@user)
end end
describe "for commits" do
let(:project) { create(:project, :repository) }
let(:commit) { project.commit } let(:commit) { project.commit }
before do before do
login_as :user allow_any_instance_of(Commit).to receive(:title).
project.team << [@user, :developer] and_return("fix #{issue.to_reference}\n\nask #{fred.to_reference} for details")
end end
describe "for commits" do
it "renders title in commits#index" do it "renders title in commits#index" do
visit namespace_project_commits_path(project.namespace, project, 'master', limit: 1) visit namespace_project_commits_path(project.namespace, project, 'master', limit: 1)
...@@ -92,6 +92,8 @@ describe "GitLab Flavored Markdown", feature: true do ...@@ -92,6 +92,8 @@ describe "GitLab Flavored Markdown", feature: true do
end end
describe "for merge requests" do describe "for merge requests" do
let(:project) { create(:project, :repository) }
before do before do
@merge_request = create(:merge_request, source_project: project, target_project: project, title: "fix #{issue.to_reference}") @merge_request = create(:merge_request, source_project: project, target_project: project, title: "fix #{issue.to_reference}")
end end
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Global search', feature: true do feature 'Global search', feature: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) } let(:project) { create(:empty_project, namespace: user.namespace) }
before do before do
project.team << [user, :master] project.team << [user, :master]
......
...@@ -6,20 +6,13 @@ describe 'Issues', feature: true do ...@@ -6,20 +6,13 @@ describe 'Issues', feature: true do
include SortingHelper include SortingHelper
include WaitForAjax include WaitForAjax
let(:project) { create(:project, :public) } let(:project) { create(:empty_project, :public) }
before do before do
login_as :user login_as :user
user2 = create(:user) user2 = create(:user)
project.team << [[@user, user2], :developer] project.team << [[@user, user2], :developer]
project.repository.create_file(
@user,
'.gitlab/issue_templates/bug.md',
'this is a test "bug" template',
message: 'added issue template',
branch_name: 'master')
end end
describe 'Edit issue' do describe 'Edit issue' do
...@@ -378,7 +371,7 @@ describe 'Issues', feature: true do ...@@ -378,7 +371,7 @@ describe 'Issues', feature: true do
end end
describe 'when I want to reset my incoming email token' do describe 'when I want to reset my incoming email token' do
let(:project1) { create(:project, namespace: @user.namespace) } let(:project1) { create(:empty_project, namespace: @user.namespace) }
let!(:issue) { create(:issue, project: project1) } let!(:issue) { create(:issue, project: project1) }
before do before do
...@@ -610,7 +603,16 @@ describe 'Issues', feature: true do ...@@ -610,7 +603,16 @@ describe 'Issues', feature: true do
end end
context 'form filled by URL parameters' do context 'form filled by URL parameters' do
let(:project) { create(:project, :public, :repository) }
before do before do
project.repository.create_file(
@user,
'.gitlab/issue_templates/bug.md',
'this is a test "bug" template',
message: 'added issue template',
branch_name: 'master')
visit new_namespace_project_issue_path(project.namespace, project, issuable_template: 'bug') visit new_namespace_project_issue_path(project.namespace, project, issuable_template: 'bug')
end end
......
require 'spec_helper' require 'spec_helper'
feature 'Member autocomplete', :js do feature 'Member autocomplete', :js do
let(:project) { create(:project, :public) } let(:project) { create(:empty_project, :public) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:author) { create(:user) } let(:author) { create(:user) }
let(:note) { create(:note, noteable: noteable, project: noteable.project) } let(:note) { create(:note, noteable: noteable, project: noteable.project) }
...@@ -36,6 +36,7 @@ feature 'Member autocomplete', :js do ...@@ -36,6 +36,7 @@ feature 'Member autocomplete', :js do
end end
context 'adding a new note on a Merge Request' do context 'adding a new note on a Merge Request' do
let(:project) { create(:project, :public, :repository) }
let(:noteable) do let(:noteable) do
create(:merge_request, source_project: project, create(:merge_request, source_project: project,
target_project: project, author: author) target_project: project, author: author)
...@@ -48,6 +49,7 @@ feature 'Member autocomplete', :js do ...@@ -48,6 +49,7 @@ feature 'Member autocomplete', :js do
end end
context 'adding a new note on a Commit' do context 'adding a new note on a Commit' do
let(:project) { create(:project, :public, :repository) }
let(:noteable) { project.commit } let(:noteable) { project.commit }
let(:note) { create(:note_on_commit, project: project, commit_id: project.commit.id) } let(:note) { create(:note_on_commit, project: project, commit_id: project.commit.id) }
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Project', feature: true do feature 'Project', feature: true do
describe 'description' do describe 'description' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:path) { namespace_project_path(project.namespace, project) } let(:path) { namespace_project_path(project.namespace, project) }
before do before do
...@@ -36,7 +36,7 @@ feature 'Project', feature: true do ...@@ -36,7 +36,7 @@ feature 'Project', feature: true do
describe 'remove forked relationship', js: true do describe 'remove forked relationship', js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) } let(:project) { create(:empty_project, namespace: user.namespace) }
before do before do
login_with user login_with user
...@@ -57,7 +57,7 @@ feature 'Project', feature: true do ...@@ -57,7 +57,7 @@ feature 'Project', feature: true do
describe 'removal', js: true do describe 'removal', js: true do
let(:user) { create(:user, username: 'test', name: 'test') } let(:user) { create(:user, username: 'test', name: 'test') }
let(:project) { create(:project, namespace: user.namespace, name: 'project1') } let(:project) { create(:empty_project, namespace: user.namespace, name: 'project1') }
before do before do
login_with(user) login_with(user)
...@@ -78,7 +78,7 @@ feature 'Project', feature: true do ...@@ -78,7 +78,7 @@ feature 'Project', feature: true do
include WaitForAjax include WaitForAjax
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) } let(:project) { create(:empty_project, namespace: user.namespace) }
before do before do
login_with(user) login_with(user)
...@@ -94,8 +94,8 @@ feature 'Project', feature: true do ...@@ -94,8 +94,8 @@ feature 'Project', feature: true do
describe 'project title' do describe 'project title' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) } let(:project) { create(:empty_project, namespace: user.namespace) }
let(:project2) { create(:project, namespace: user.namespace, path: 'test') } let(:project2) { create(:empty_project, namespace: user.namespace, path: 'test') }
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
context 'on issues page', js: true do context 'on issues page', js: true do
......
...@@ -5,7 +5,7 @@ feature 'Projected Branches', feature: true, js: true do ...@@ -5,7 +5,7 @@ feature 'Projected Branches', feature: true, js: true do
include WaitForAjax include WaitForAjax
let(:user) { create(:user, :admin) } let(:user) { create(:user, :admin) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
before { login_as(user) } before { login_as(user) }
......
...@@ -5,7 +5,7 @@ feature 'Projected Tags', feature: true, js: true do ...@@ -5,7 +5,7 @@ feature 'Projected Tags', feature: true, js: true do
include WaitForAjax include WaitForAjax
let(:user) { create(:user, :admin) } let(:user) { create(:user, :admin) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
before { login_as(user) } before { login_as(user) }
......
...@@ -5,7 +5,7 @@ describe "Search", feature: true do ...@@ -5,7 +5,7 @@ describe "Search", feature: true do
include WaitForAjax include WaitForAjax
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) } let(:project) { create(:empty_project, namespace: user.namespace) }
let!(:issue) { create(:issue, project: project, assignee: user) } let!(:issue) { create(:issue, project: project, assignee: user) }
let!(:issue2) { create(:issue, project: project, author: user) } let!(:issue2) { create(:issue, project: project, author: user) }
...@@ -62,6 +62,7 @@ describe "Search", feature: true do ...@@ -62,6 +62,7 @@ describe "Search", feature: true do
context 'search for comments' do context 'search for comments' do
context 'when comment belongs to a invalid commit' do context 'when comment belongs to a invalid commit' do
let(:project) { create(:project, :repository) }
let(:note) { create(:note_on_commit, author: user, project: project, commit_id: project.repository.commit.id, note: 'Bug here') } let(:note) { create(:note_on_commit, author: user, project: project, commit_id: project.repository.commit.id, note: 'Bug here') }
before { note.update_attributes(commit_id: 12345678) } before { note.update_attributes(commit_id: 12345678) }
...@@ -103,6 +104,7 @@ describe "Search", feature: true do ...@@ -103,6 +104,7 @@ describe "Search", feature: true do
end end
it 'finds a commit' do it 'finds a commit' do
project = create(:project, :repository) { |p| p.add_reporter(user) }
visit namespace_project_path(project.namespace, project) visit namespace_project_path(project.namespace, project)
page.within '.search' do page.within '.search' do
...@@ -116,6 +118,7 @@ describe "Search", feature: true do ...@@ -116,6 +118,7 @@ describe "Search", feature: true do
end end
it 'finds a code' do it 'finds a code' do
project = create(:project, :repository) { |p| p.add_reporter(user) }
visit namespace_project_path(project.namespace, project) visit namespace_project_path(project.namespace, project)
page.within '.search' do page.within '.search' do
...@@ -222,6 +225,8 @@ describe "Search", feature: true do ...@@ -222,6 +225,8 @@ describe "Search", feature: true do
end end
describe 'search for commits' do describe 'search for commits' do
let(:project) { create(:project, :repository) }
before do before do
visit search_path(project_id: project.id) visit search_path(project_id: project.id)
end end
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
feature 'Task Lists', feature: true do feature 'Task Lists', feature: true do
include Warden::Test::Helpers include Warden::Test::Helpers
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:user2) { create(:user) } let(:user2) { create(:user) }
...@@ -240,6 +240,7 @@ feature 'Task Lists', feature: true do ...@@ -240,6 +240,7 @@ feature 'Task Lists', feature: true do
end end
describe 'multiple tasks' do describe 'multiple tasks' do
let(:project) { create(:project, :repository) }
let!(:merge) { create(:merge_request, :simple, description: markdown, author: user, source_project: project) } let!(:merge) { create(:merge_request, :simple, description: markdown, author: user, source_project: project) }
it 'renders for description' do it 'renders for description' do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'Project variables', js: true do describe 'Project variables', js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:variable) { create(:ci_variable, key: 'test_key', value: 'test value') } let(:variable) { create(:ci_variable, key: 'test_key', value: 'test value') }
before do before do
......
...@@ -23,7 +23,7 @@ class MarkdownFeature ...@@ -23,7 +23,7 @@ class MarkdownFeature
# Direct references ---------------------------------------------------------- # Direct references ----------------------------------------------------------
def project def project
@project ||= create(:project).tap do |project| @project ||= create(:project, :repository).tap do |project|
project.team << [user, :master] project.team << [user, :master]
end end
end end
...@@ -80,7 +80,7 @@ class MarkdownFeature ...@@ -80,7 +80,7 @@ class MarkdownFeature
def xproject def xproject
@xproject ||= begin @xproject ||= begin
group = create(:group, :nested) group = create(:group, :nested)
create(:project, namespace: group) do |project| create(:project, :repository, namespace: group) do |project|
project.team << [user, :developer] project.team << [user, :developer]
end end
end end
......
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