@@ -43,7 +43,7 class CustomFieldsController < ApplicationController | |||||
43 | if @custom_field.save |
|
43 | if @custom_field.save | |
44 | flash[:notice] = l(:notice_successful_create) |
|
44 | flash[:notice] = l(:notice_successful_create) | |
45 | call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field) |
|
45 | call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field) | |
46 |
redirect_to custom_field |
|
46 | redirect_to edit_custom_field_path(@custom_field) | |
47 | else |
|
47 | else | |
48 | render :action => 'new' |
|
48 | render :action => 'new' | |
49 | end |
|
49 | end | |
@@ -56,7 +56,7 class CustomFieldsController < ApplicationController | |||||
56 | if @custom_field.update_attributes(params[:custom_field]) |
|
56 | if @custom_field.update_attributes(params[:custom_field]) | |
57 | flash[:notice] = l(:notice_successful_update) |
|
57 | flash[:notice] = l(:notice_successful_update) | |
58 | call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field) |
|
58 | call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field) | |
59 |
redirect_to custom_field |
|
59 | redirect_to edit_custom_field_path(@custom_field) | |
60 | else |
|
60 | else | |
61 | render :action => 'edit' |
|
61 | render :action => 'edit' | |
62 | end |
|
62 | end |
@@ -139,7 +139,7 class CustomFieldsControllerTest < ActionController::TestCase | |||||
139 | end |
|
139 | end | |
140 |
|
140 | |||
141 | def test_create_list_custom_field |
|
141 | def test_create_list_custom_field | |
142 | assert_difference 'CustomField.count' do |
|
142 | field = new_record(IssueCustomField) do | |
143 | post :create, :type => "IssueCustomField", |
|
143 | post :create, :type => "IssueCustomField", | |
144 | :custom_field => {:name => "test_post_new_list", |
|
144 | :custom_field => {:name => "test_post_new_list", | |
145 | :default_value => "", |
|
145 | :default_value => "", | |
@@ -154,9 +154,8 class CustomFieldsControllerTest < ActionController::TestCase | |||||
154 | :field_format => "list", |
|
154 | :field_format => "list", | |
155 | :tracker_ids => ["1", ""]} |
|
155 | :tracker_ids => ["1", ""]} | |
156 | end |
|
156 | end | |
157 |
assert_redirected_to |
|
157 | assert_redirected_to "/custom_fields/#{field.id}/edit" | |
158 | field = IssueCustomField.find_by_name('test_post_new_list') |
|
158 | assert_equal "test_post_new_list", field.name | |
159 | assert_not_nil field |
|
|||
160 | assert_equal ["0.1", "0.2"], field.possible_values |
|
159 | assert_equal ["0.1", "0.2"], field.possible_values | |
161 | assert_equal 1, field.trackers.size |
|
160 | assert_equal 1, field.trackers.size | |
162 | end |
|
161 | end | |
@@ -202,7 +201,7 class CustomFieldsControllerTest < ActionController::TestCase | |||||
202 |
|
201 | |||
203 | def test_update |
|
202 | def test_update | |
204 | put :update, :id => 1, :custom_field => {:name => 'New name'} |
|
203 | put :update, :id => 1, :custom_field => {:name => 'New name'} | |
205 |
assert_redirected_to '/custom_fields |
|
204 | assert_redirected_to '/custom_fields/1/edit' | |
206 |
|
205 | |||
207 | field = CustomField.find(1) |
|
206 | field = CustomField.find(1) | |
208 | assert_equal 'New name', field.name |
|
207 | assert_equal 'New name', field.name |
General Comments 0
You need to be logged in to leave comments.
Login now