@@ -109,6 +109,10 class VersionsController < ApplicationController | |||||
109 | if @version.update_attributes(attributes) |
|
109 | if @version.update_attributes(attributes) | |
110 | flash[:notice] = l(:notice_successful_update) |
|
110 | flash[:notice] = l(:notice_successful_update) | |
111 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project |
|
111 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project | |
|
112 | else | |||
|
113 | respond_to do |format| | |||
|
114 | format.html { render :action => 'edit' } | |||
|
115 | end | |||
112 | end |
|
116 | end | |
113 | end |
|
117 | end | |
114 | end |
|
118 | end |
@@ -123,6 +123,15 class VersionsControllerTest < ActionController::TestCase | |||||
123 | assert_equal 'New version name', version.name |
|
123 | assert_equal 'New version name', version.name | |
124 | assert_equal Date.today, version.effective_date |
|
124 | assert_equal Date.today, version.effective_date | |
125 | end |
|
125 | end | |
|
126 | ||||
|
127 | def test_post_update_with_validation_failure | |||
|
128 | @request.session[:user_id] = 2 | |||
|
129 | put :update, :id => 2, | |||
|
130 | :version => { :name => '', | |||
|
131 | :effective_date => Date.today.strftime("%Y-%m-%d")} | |||
|
132 | assert_response :success | |||
|
133 | assert_template 'edit' | |||
|
134 | end | |||
126 |
|
135 | |||
127 | def test_destroy |
|
136 | def test_destroy | |
128 | @request.session[:user_id] = 2 |
|
137 | @request.session[:user_id] = 2 |
General Comments 0
You need to be logged in to leave comments.
Login now