if @custom_field.save
flash[:notice] = l(:notice_successful_create)
call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field)
- redirect_to custom_fields_path(:tab => @custom_field.class.name)
+ redirect_to edit_custom_field_path(@custom_field)
else
render :action => 'new'
end
if @custom_field.update_attributes(params[:custom_field])
flash[:notice] = l(:notice_successful_update)
call_hook(:controller_custom_fields_edit_after_save, :params => params, :custom_field => @custom_field)
- redirect_to custom_fields_path(:tab => @custom_field.class.name)
+ redirect_to edit_custom_field_path(@custom_field)
else
render :action => 'edit'
end
end
def test_create_list_custom_field
- assert_difference 'CustomField.count' do
+ field = new_record(IssueCustomField) do
post :create, :type => "IssueCustomField",
:custom_field => {:name => "test_post_new_list",
:default_value => "",
:field_format => "list",
:tracker_ids => ["1", ""]}
end
- assert_redirected_to '/custom_fields?tab=IssueCustomField'
- field = IssueCustomField.find_by_name('test_post_new_list')
- assert_not_nil field
+ assert_redirected_to "/custom_fields/#{field.id}/edit"
+ assert_equal "test_post_new_list", field.name
assert_equal ["0.1", "0.2"], field.possible_values
assert_equal 1, field.trackers.size
end
def test_update
put :update, :id => 1, :custom_field => {:name => 'New name'}
- assert_redirected_to '/custom_fields?tab=IssueCustomField'
+ assert_redirected_to '/custom_fields/1/edit'
field = CustomField.find(1)
assert_equal 'New name', field.name