Commit 71678f08f8b008d06da98fdae1905e1880300c00
Exists in
spb-stable
and in
3 other branches
Merge branch 'issue_on_empty_repo' into 'master'
Fix for error 500 on create issue for empty repo
Showing
3 changed files
with
31 additions
and
1 deletions
Show diff stats
app/views/projects/issues/_form.html.haml
| 1 | 1 | %div.issue-form-holder |
| 2 | 2 | %h3.page-title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.iid}" |
| 3 | 3 | %hr |
| 4 | - - if !@repository.empty? && @repository.contribution_guide && !@issue.persisted? | |
| 4 | + - if @repository.exists? && !@repository.empty? && @repository.contribution_guide && !@issue.persisted? | |
| 5 | 5 | - contribution_guide_url = project_blob_path(@project, tree_join(@repository.root_ref, @repository.contribution_guide.name)) |
| 6 | 6 | .alert.alert-info.col-sm-10.col-sm-offset-2 |
| 7 | 7 | ="Please review the <strong>#{link_to "guidelines for contribution", contribution_guide_url}</strong> to this repository.".html_safe | ... | ... |
features/project/issues/issues.feature
| ... | ... | @@ -67,3 +67,12 @@ Feature: Project Issues |
| 67 | 67 | Given I visit issue page "Release 0.4" |
| 68 | 68 | And I leave a comment with a header containing "Comment with a header" |
| 69 | 69 | Then The comment with the header should not have an ID |
| 70 | + | |
| 71 | + Scenario: Issues on empty project | |
| 72 | + Given empty project "Empty Project" | |
| 73 | + When I visit empty project page | |
| 74 | + And I see empty project details with ssh clone info | |
| 75 | + When I visit empty project's issues page | |
| 76 | + Given I click link "New Issue" | |
| 77 | + And I submit new issue "500 error on profile" | |
| 78 | + Then I should see issue "500 error on profile" | ... | ... |
features/steps/project/issues.rb
| ... | ... | @@ -142,4 +142,25 @@ class ProjectIssues < Spinach::FeatureSteps |
| 142 | 142 | project: project, |
| 143 | 143 | author: project.users.first) |
| 144 | 144 | end |
| 145 | + | |
| 146 | + Given 'empty project "Empty Project"' do | |
| 147 | + create :empty_project, name: 'Empty Project', namespace: @user.namespace | |
| 148 | + end | |
| 149 | + | |
| 150 | + When 'I visit empty project page' do | |
| 151 | + project = Project.find_by(name: 'Empty Project') | |
| 152 | + visit project_path(project) | |
| 153 | + end | |
| 154 | + | |
| 155 | + And 'I see empty project details with ssh clone info' do | |
| 156 | + project = Project.find_by(name: 'Empty Project') | |
| 157 | + page.all(:css, '.git-empty .clone').each do |element| | |
| 158 | + element.text.should include(project.url_to_repo) | |
| 159 | + end | |
| 160 | + end | |
| 161 | + | |
| 162 | + When "I visit empty project's issues page" do | |
| 163 | + project = Project.find_by(name: 'Empty Project') | |
| 164 | + visit project_issues_path(project) | |
| 165 | + end | |
| 145 | 166 | end | ... | ... |