From f1f0704ef82fe784ac9a23809c9fd3ba3a7f4283 2010-11-01 13:14:14 From: Jean-Philippe Lang Date: 2010-11-01 13:14:14 Subject: [PATCH] Merged r4354 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@4355 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index 331935d..c3cf27c 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -109,6 +109,10 @@ class VersionsController < ApplicationController if @version.update_attributes(attributes) flash[:notice] = l(:notice_successful_update) redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project + else + respond_to do |format| + format.html { render :action => 'edit' } + end end end end diff --git a/test/functional/versions_controller_test.rb b/test/functional/versions_controller_test.rb index 1b33ba8..05b0af9 100644 --- a/test/functional/versions_controller_test.rb +++ b/test/functional/versions_controller_test.rb @@ -123,6 +123,15 @@ class VersionsControllerTest < ActionController::TestCase assert_equal 'New version name', version.name assert_equal Date.today, version.effective_date end + + def test_post_update_with_validation_failure + @request.session[:user_id] = 2 + put :update, :id => 2, + :version => { :name => '', + :effective_date => Date.today.strftime("%Y-%m-%d")} + assert_response :success + assert_template 'edit' + end def test_destroy @request.session[:user_id] = 2