summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-04-09 10:11:45 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-04-09 10:11:45 +0000
commit71678f08f8b008d06da98fdae1905e1880300c00 (patch)
treeab970273e5739270b0a49c813bade5e52abba3d9
parente099d6621353029954ca8855be73f2b83873bc63 (diff)
parente617cf95d448891d51361154d6845218cb5a4508 (diff)
downloadgitlab-ce-71678f08f8b008d06da98fdae1905e1880300c00.tar.gz
Merge branch 'issue_on_empty_repo' into 'master'
Fix for error 500 on create issue for empty repo
-rw-r--r--app/views/projects/issues/_form.html.haml2
-rw-r--r--features/project/issues/issues.feature9
-rw-r--r--features/steps/project/issues.rb21
3 files changed, 31 insertions, 1 deletions
diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml
index 05cae80e50c..91d0de8e47c 100644
--- a/app/views/projects/issues/_form.html.haml
+++ b/app/views/projects/issues/_form.html.haml
@@ -1,7 +1,7 @@
%div.issue-form-holder
%h3.page-title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.iid}"
%hr
- - if !@repository.empty? && @repository.contribution_guide && !@issue.persisted?
+ - if @repository.exists? && !@repository.empty? && @repository.contribution_guide && !@issue.persisted?
- contribution_guide_url = project_blob_path(@project, tree_join(@repository.root_ref, @repository.contribution_guide.name))
.alert.alert-info.col-sm-10.col-sm-offset-2
="Please review the <strong>#{link_to "guidelines for contribution", contribution_guide_url}</strong> to this repository.".html_safe
diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature
index 033051991e2..c5311544efa 100644
--- a/features/project/issues/issues.feature
+++ b/features/project/issues/issues.feature
@@ -67,3 +67,12 @@ Feature: Project Issues
Given I visit issue page "Release 0.4"
And I leave a comment with a header containing "Comment with a header"
Then The comment with the header should not have an ID
+
+ Scenario: Issues on empty project
+ Given empty project "Empty Project"
+ When I visit empty project page
+ And I see empty project details with ssh clone info
+ When I visit empty project's issues page
+ Given I click link "New Issue"
+ And I submit new issue "500 error on profile"
+ Then I should see issue "500 error on profile"
diff --git a/features/steps/project/issues.rb b/features/steps/project/issues.rb
index a92fd50584d..d1f3ba25a21 100644
--- a/features/steps/project/issues.rb
+++ b/features/steps/project/issues.rb
@@ -142,4 +142,25 @@ class ProjectIssues < Spinach::FeatureSteps
project: project,
author: project.users.first)
end
+
+ Given 'empty project "Empty Project"' do
+ create :empty_project, name: 'Empty Project', namespace: @user.namespace
+ end
+
+ When 'I visit empty project page' do
+ project = Project.find_by(name: 'Empty Project')
+ visit project_path(project)
+ end
+
+ And 'I see empty project details with ssh clone info' do
+ project = Project.find_by(name: 'Empty Project')
+ page.all(:css, '.git-empty .clone').each do |element|
+ element.text.should include(project.url_to_repo)
+ end
+ end
+
+ When "I visit empty project's issues page" do
+ project = Project.find_by(name: 'Empty Project')
+ visit project_issues_path(project)
+ end
end