summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-04-24 14:57:31 +0000
committerRémy Coutable <remy@rymai.me>2017-04-24 14:57:31 +0000
commit8e6dabb0118a8245f42974f9e92fe53ccb1c43f2 (patch)
treec92d7f9c4ce8804e4373f638df8c76b2c4458fd4
parent7e335d20248c4dc4788a0eb0b7ef87a0d5cada6c (diff)
parentaef345024f72ca8d4b57a65b149d018a50219a87 (diff)
downloadgitlab-ce-8e6dabb0118a8245f42974f9e92fe53ccb1c43f2.tar.gz
Merge branch 'rs-empty-project-features' into 'master'
Use `:empty_project` where possible in top-level feature specs See merge request !10836
-rw-r--r--spec/features/auto_deploy_spec.rb2
-rw-r--r--spec/features/calendar_spec.rb2
-rw-r--r--spec/features/commits_spec.rb2
-rw-r--r--spec/features/copy_as_gfm_spec.rb2
-rw-r--r--spec/features/cycle_analytics_spec.rb2
-rw-r--r--spec/features/dashboard_issues_spec.rb2
-rw-r--r--spec/features/expand_collapse_diffs_spec.rb2
-rw-r--r--spec/features/gitlab_flavored_markdown_spec.rb28
-rw-r--r--spec/features/global_search_spec.rb2
-rw-r--r--spec/features/issues_spec.rb20
-rw-r--r--spec/features/participants_autocomplete_spec.rb4
-rw-r--r--spec/features/projects_spec.rb12
-rw-r--r--spec/features/protected_branches_spec.rb2
-rw-r--r--spec/features/protected_tags_spec.rb2
-rw-r--r--spec/features/search_spec.rb7
-rw-r--r--spec/features/task_lists_spec.rb3
-rw-r--r--spec/features/variables_spec.rb2
-rw-r--r--spec/support/markdown_feature.rb4
18 files changed, 56 insertions, 44 deletions
diff --git a/spec/features/auto_deploy_spec.rb b/spec/features/auto_deploy_spec.rb
index 6f36c74c911..f6f0f6d6233 100644
--- a/spec/features/auto_deploy_spec.rb
+++ b/spec/features/auto_deploy_spec.rb
@@ -4,7 +4,7 @@ describe 'Auto deploy' do
include WaitForAjax
let(:user) { create(:user) }
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
before do
project.create_kubernetes_service(
diff --git a/spec/features/calendar_spec.rb b/spec/features/calendar_spec.rb
index 35d090c4b7f..59bd5ab09f9 100644
--- a/spec/features/calendar_spec.rb
+++ b/spec/features/calendar_spec.rb
@@ -4,7 +4,7 @@ feature 'Contributions Calendar', :feature, :js do
include WaitForAjax
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) }
# Ex/ Sunday Jan 1, 2016
diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb
index 881f1fca4d1..e6c4ab24de5 100644
--- a/spec/features/commits_spec.rb
+++ b/spec/features/commits_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe 'Commits' do
include CiStatusHelper
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
describe 'CI' do
before do
diff --git a/spec/features/copy_as_gfm_spec.rb b/spec/features/copy_as_gfm_spec.rb
index 55df7e45f79..64a6c70061b 100644
--- a/spec/features/copy_as_gfm_spec.rb
+++ b/spec/features/copy_as_gfm_spec.rb
@@ -433,7 +433,7 @@ describe 'Copy as GFM', feature: true, js: true do
end
describe 'Copying code' do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
context 'from a diff' do
before do
diff --git a/spec/features/cycle_analytics_spec.rb b/spec/features/cycle_analytics_spec.rb
index 0648c89a5c7..a79eb873b76 100644
--- a/spec/features/cycle_analytics_spec.rb
+++ b/spec/features/cycle_analytics_spec.rb
@@ -5,7 +5,7 @@ feature 'Cycle Analytics', feature: true, js: true do
let(:user) { 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(:milestone) { create(:milestone, project: project) }
let(:mr) { create_merge_request_closing_issue(issue) }
diff --git a/spec/features/dashboard_issues_spec.rb b/spec/features/dashboard_issues_spec.rb
index 8c61cdebc4b..b6b87905231 100644
--- a/spec/features/dashboard_issues_spec.rb
+++ b/spec/features/dashboard_issues_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "Dashboard Issues filtering", feature: true, js: true do
let(:user) { create(:user) }
- let(:project) { create(:project) }
+ let(:project) { create(:empty_project) }
let(:milestone) { create(:milestone, project: project) }
context 'filtering by milestone' do
diff --git a/spec/features/expand_collapse_diffs_spec.rb b/spec/features/expand_collapse_diffs_spec.rb
index 8c64b050e19..7e9a57a41f1 100644
--- a/spec/features/expand_collapse_diffs_spec.rb
+++ b/spec/features/expand_collapse_diffs_spec.rb
@@ -4,7 +4,7 @@ feature 'Expand and collapse diffs', js: true, feature: true do
include WaitForAjax
let(:branch) { 'expand-collapse-diffs' }
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
before do
login_as :admin
diff --git a/spec/features/gitlab_flavored_markdown_spec.rb b/spec/features/gitlab_flavored_markdown_spec.rb
index 876f33dd03e..01b1aee4fd3 100644
--- a/spec/features/gitlab_flavored_markdown_spec.rb
+++ b/spec/features/gitlab_flavored_markdown_spec.rb
@@ -1,28 +1,28 @@
require 'spec_helper'
describe "GitLab Flavored Markdown", feature: true do
- let(:project) { create(:project) }
+ let(:project) { create(:empty_project) }
let(:issue) { create(:issue, project: project) }
- let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
let(:fred) do
- u = create(:user, name: "fred")
- project.team << [u, :master]
- u
+ create(:user, name: 'fred') do |user|
+ project.add_master(user)
+ end
end
before do
- allow_any_instance_of(Commit).to receive(:title).
- and_return("fix #{issue.to_reference}\n\nask #{fred.to_reference} for details")
+ login_as(:user)
+ project.add_developer(@user)
end
- let(:commit) { project.commit }
+ describe "for commits" do
+ let(:project) { create(:project, :repository) }
+ let(:commit) { project.commit }
- before do
- login_as :user
- project.team << [@user, :developer]
- end
+ before do
+ allow_any_instance_of(Commit).to receive(:title).
+ and_return("fix #{issue.to_reference}\n\nask #{fred.to_reference} for details")
+ end
- describe "for commits" do
it "renders title in commits#index" do
visit namespace_project_commits_path(project.namespace, project, 'master', limit: 1)
@@ -92,6 +92,8 @@ describe "GitLab Flavored Markdown", feature: true do
end
describe "for merge requests" do
+ let(:project) { create(:project, :repository) }
+
before do
@merge_request = create(:merge_request, source_project: project, target_project: project, title: "fix #{issue.to_reference}")
end
diff --git a/spec/features/global_search_spec.rb b/spec/features/global_search_spec.rb
index f6409e00f22..4b22b07494d 100644
--- a/spec/features/global_search_spec.rb
+++ b/spec/features/global_search_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Global search', feature: true do
let(:user) { create(:user) }
- let(:project) { create(:project, namespace: user.namespace) }
+ let(:project) { create(:empty_project, namespace: user.namespace) }
before do
project.team << [user, :master]
diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb
index 55eca187f6c..b43bf7d354e 100644
--- a/spec/features/issues_spec.rb
+++ b/spec/features/issues_spec.rb
@@ -6,20 +6,13 @@ describe 'Issues', feature: true do
include SortingHelper
include WaitForAjax
- let(:project) { create(:project, :public) }
+ let(:project) { create(:empty_project, :public) }
before do
login_as :user
user2 = create(:user)
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
describe 'Edit issue' do
@@ -378,7 +371,7 @@ describe 'Issues', feature: true do
end
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) }
before do
@@ -610,7 +603,16 @@ describe 'Issues', feature: true do
end
context 'form filled by URL parameters' do
+ let(:project) { create(:project, :public, :repository) }
+
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')
end
diff --git a/spec/features/participants_autocomplete_spec.rb b/spec/features/participants_autocomplete_spec.rb
index decad589c23..449ce80bc71 100644
--- a/spec/features/participants_autocomplete_spec.rb
+++ b/spec/features/participants_autocomplete_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
feature 'Member autocomplete', :js do
- let(:project) { create(:project, :public) }
+ let(:project) { create(:empty_project, :public) }
let(:user) { create(:user) }
let(:author) { create(:user) }
let(:note) { create(:note, noteable: noteable, project: noteable.project) }
@@ -36,6 +36,7 @@ feature 'Member autocomplete', :js do
end
context 'adding a new note on a Merge Request' do
+ let(:project) { create(:project, :public, :repository) }
let(:noteable) do
create(:merge_request, source_project: project,
target_project: project, author: author)
@@ -48,6 +49,7 @@ feature 'Member autocomplete', :js do
end
context 'adding a new note on a Commit' do
+ let(:project) { create(:project, :public, :repository) }
let(:noteable) { project.commit }
let(:note) { create(:note_on_commit, project: project, commit_id: project.commit.id) }
diff --git a/spec/features/projects_spec.rb b/spec/features/projects_spec.rb
index ba56030e28d..118a08fed85 100644
--- a/spec/features/projects_spec.rb
+++ b/spec/features/projects_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Project', feature: true do
describe 'description' do
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
let(:path) { namespace_project_path(project.namespace, project) }
before do
@@ -36,7 +36,7 @@ feature 'Project', feature: true do
describe 'remove forked relationship', js: true do
let(:user) { create(:user) }
- let(:project) { create(:project, namespace: user.namespace) }
+ let(:project) { create(:empty_project, namespace: user.namespace) }
before do
login_with user
@@ -57,7 +57,7 @@ feature 'Project', feature: true do
describe 'removal', js: true do
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
login_with(user)
@@ -78,7 +78,7 @@ feature 'Project', feature: true do
include WaitForAjax
let(:user) { create(:user) }
- let(:project) { create(:project, namespace: user.namespace) }
+ let(:project) { create(:empty_project, namespace: user.namespace) }
before do
login_with(user)
@@ -94,8 +94,8 @@ feature 'Project', feature: true do
describe 'project title' do
let(:user) { create(:user) }
- let(:project) { create(:project, namespace: user.namespace) }
- let(:project2) { create(:project, namespace: user.namespace, path: 'test') }
+ let(:project) { create(:empty_project, namespace: user.namespace) }
+ let(:project2) { create(:empty_project, namespace: user.namespace, path: 'test') }
let(:issue) { create(:issue, project: project) }
context 'on issues page', js: true do
diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb
index 1a3f7b970f6..e9e2a009ed5 100644
--- a/spec/features/protected_branches_spec.rb
+++ b/spec/features/protected_branches_spec.rb
@@ -5,7 +5,7 @@ feature 'Projected Branches', feature: true, js: true do
include WaitForAjax
let(:user) { create(:user, :admin) }
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
before { login_as(user) }
diff --git a/spec/features/protected_tags_spec.rb b/spec/features/protected_tags_spec.rb
index 09e8c850de3..f97f6156184 100644
--- a/spec/features/protected_tags_spec.rb
+++ b/spec/features/protected_tags_spec.rb
@@ -5,7 +5,7 @@ feature 'Projected Tags', feature: true, js: true do
include WaitForAjax
let(:user) { create(:user, :admin) }
- let(:project) { create(:project) }
+ let(:project) { create(:project, :repository) }
before { login_as(user) }
diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb
index e8ad28a00f0..9679b731969 100644
--- a/spec/features/search_spec.rb
+++ b/spec/features/search_spec.rb
@@ -5,7 +5,7 @@ describe "Search", feature: true do
include WaitForAjax
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!(:issue2) { create(:issue, project: project, author: user) }
@@ -62,6 +62,7 @@ describe "Search", feature: true do
context 'search for comments' 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') }
before { note.update_attributes(commit_id: 12345678) }
@@ -103,6 +104,7 @@ describe "Search", feature: true do
end
it 'finds a commit' do
+ project = create(:project, :repository) { |p| p.add_reporter(user) }
visit namespace_project_path(project.namespace, project)
page.within '.search' do
@@ -116,6 +118,7 @@ describe "Search", feature: true do
end
it 'finds a code' do
+ project = create(:project, :repository) { |p| p.add_reporter(user) }
visit namespace_project_path(project.namespace, project)
page.within '.search' do
@@ -222,6 +225,8 @@ describe "Search", feature: true do
end
describe 'search for commits' do
+ let(:project) { create(:project, :repository) }
+
before do
visit search_path(project_id: project.id)
end
diff --git a/spec/features/task_lists_spec.rb b/spec/features/task_lists_spec.rb
index a5d14aa19f1..c33692fc4a9 100644
--- a/spec/features/task_lists_spec.rb
+++ b/spec/features/task_lists_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
feature 'Task Lists', feature: true do
include Warden::Test::Helpers
- let(:project) { create(:project) }
+ let(:project) { create(:empty_project) }
let(:user) { create(:user) }
let(:user2) { create(:user) }
@@ -240,6 +240,7 @@ feature 'Task Lists', feature: true do
end
describe 'multiple tasks' do
+ let(:project) { create(:project, :repository) }
let!(:merge) { create(:merge_request, :simple, description: markdown, author: user, source_project: project) }
it 'renders for description' do
diff --git a/spec/features/variables_spec.rb b/spec/features/variables_spec.rb
index a362d6fd3b6..b83a230c1f8 100644
--- a/spec/features/variables_spec.rb
+++ b/spec/features/variables_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'Project variables', js: true do
let(:user) { create(:user) }
- let(:project) { create(:project) }
+ let(:project) { create(:empty_project) }
let(:variable) { create(:ci_variable, key: 'test_key', value: 'test value') }
before do
diff --git a/spec/support/markdown_feature.rb b/spec/support/markdown_feature.rb
index dea0015f105..21a054af4e1 100644
--- a/spec/support/markdown_feature.rb
+++ b/spec/support/markdown_feature.rb
@@ -23,7 +23,7 @@ class MarkdownFeature
# Direct references ----------------------------------------------------------
def project
- @project ||= create(:project).tap do |project|
+ @project ||= create(:project, :repository).tap do |project|
project.team << [user, :master]
end
end
@@ -80,7 +80,7 @@ class MarkdownFeature
def xproject
@xproject ||= begin
group = create(:group, :nested)
- create(:project, namespace: group) do |project|
+ create(:project, :repository, namespace: group) do |project|
project.team << [user, :developer]
end
end