Commit cc51931d1f4a205de412ed8dfca98b832f4c5c91
1 parent
5582ae14
Exists in
master
and in
4 other branches
Fix 500 error when rename repository
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
3 changed files
with
18 additions
and
4 deletions
Show diff stats
app/contexts/projects/update_context.rb
| @@ -9,7 +9,7 @@ module Projects | @@ -9,7 +9,7 @@ module Projects | ||
| 9 | 9 | ||
| 10 | new_branch = params[:project].delete(:default_branch) | 10 | new_branch = params[:project].delete(:default_branch) |
| 11 | 11 | ||
| 12 | - if project.repository.exists? && new_branch != project.default_branch | 12 | + if project.repository.exists? && new_branch && new_branch != project.default_branch |
| 13 | project.change_head(new_branch) | 13 | project.change_head(new_branch) |
| 14 | end | 14 | end |
| 15 | 15 |
features/project/project.feature
| @@ -19,3 +19,8 @@ Feature: Project Feature | @@ -19,3 +19,8 @@ Feature: Project Feature | ||
| 19 | And change project settings | 19 | And change project settings |
| 20 | And I save project | 20 | And I save project |
| 21 | Then I should see project with new settings | 21 | Then I should see project with new settings |
| 22 | + | ||
| 23 | + Scenario: I change project path | ||
| 24 | + When I visit edit project "Shop" page | ||
| 25 | + And change project path settings | ||
| 26 | + Then I should see project with new path settings |
features/steps/project/project.rb
| @@ -3,16 +3,25 @@ class ProjectFeature < Spinach::FeatureSteps | @@ -3,16 +3,25 @@ class ProjectFeature < Spinach::FeatureSteps | ||
| 3 | include SharedProject | 3 | include SharedProject |
| 4 | include SharedPaths | 4 | include SharedPaths |
| 5 | 5 | ||
| 6 | - And 'change project settings' do | 6 | + step 'change project settings' do |
| 7 | fill_in 'project_name', with: 'NewName' | 7 | fill_in 'project_name', with: 'NewName' |
| 8 | uncheck 'project_issues_enabled' | 8 | uncheck 'project_issues_enabled' |
| 9 | end | 9 | end |
| 10 | 10 | ||
| 11 | - And 'I save project' do | 11 | + step 'I save project' do |
| 12 | click_button 'Save changes' | 12 | click_button 'Save changes' |
| 13 | end | 13 | end |
| 14 | 14 | ||
| 15 | - Then 'I should see project with new settings' do | 15 | + step 'I should see project with new settings' do |
| 16 | find_field('project_name').value.should == 'NewName' | 16 | find_field('project_name').value.should == 'NewName' |
| 17 | end | 17 | end |
| 18 | + | ||
| 19 | + step 'change project path settings' do | ||
| 20 | + fill_in "project_path", with: "new-path" | ||
| 21 | + click_button "Rename" | ||
| 22 | + end | ||
| 23 | + | ||
| 24 | + step 'I should see project with new path settings' do | ||
| 25 | + project.path.should == "new-path" | ||
| 26 | + end | ||
| 18 | end | 27 | end |