##// END OF EJS Templates
Code cleanup....
Jean-Philippe Lang -
r10758:24be0551ccd7
parent child
Show More
@@ -37,7 +37,6 class QueriesController < ApplicationController
37 @queries = IssueQuery.visible.all(:limit => @limit, :offset => @offset, :order => "#{Query.table_name}.name")
37 @queries = IssueQuery.visible.all(:limit => @limit, :offset => @offset, :order => "#{Query.table_name}.name")
38
38
39 respond_to do |format|
39 respond_to do |format|
40 format.html { render :nothing => true }
41 format.api
40 format.api
42 end
41 end
43 end
42 end
@@ -106,7 +106,7 class WorkflowsController < ApplicationController
106 if request.post?
106 if request.post?
107 if params[:source_tracker_id].blank? || params[:source_role_id].blank? || (@source_tracker.nil? && @source_role.nil?)
107 if params[:source_tracker_id].blank? || params[:source_role_id].blank? || (@source_tracker.nil? && @source_role.nil?)
108 flash.now[:error] = l(:error_workflow_copy_source)
108 flash.now[:error] = l(:error_workflow_copy_source)
109 elsif @target_trackers.nil? || @target_roles.nil?
109 elsif @target_trackers.blank? || @target_roles.blank?
110 flash.now[:error] = l(:error_workflow_copy_target)
110 flash.now[:error] = l(:error_workflow_copy_target)
111 else
111 else
112 WorkflowRule.copy(@source_tracker, @source_role, @target_trackers, @target_roles)
112 WorkflowRule.copy(@source_tracker, @source_role, @target_trackers, @target_roles)
@@ -81,6 +81,12 class MessagesControllerTest < ActionController::TestCase
81 assert_template 'new'
81 assert_template 'new'
82 end
82 end
83
83
84 def test_get_new_with_invalid_board
85 @request.session[:user_id] = 2
86 get :new, :board_id => 99
87 assert_response 404
88 end
89
84 def test_post_new
90 def test_post_new
85 @request.session[:user_id] = 2
91 @request.session[:user_id] = 2
86 ActionMailer::Base.deliveries.clear
92 ActionMailer::Base.deliveries.clear
@@ -24,6 +24,12 class QueriesControllerTest < ActionController::TestCase
24 User.current = nil
24 User.current = nil
25 end
25 end
26
26
27 def test_index
28 get :index
29 # HTML response not implemented
30 assert_response 406
31 end
32
27 def test_new_project_query
33 def test_new_project_query
28 @request.session[:user_id] = 2
34 @request.session[:user_id] = 2
29 get :new, :project_id => 1
35 get :new, :project_id => 1
@@ -297,6 +297,26 class WorkflowsControllerTest < ActionController::TestCase
297 assert_equal source_t3, status_transitions(:tracker_id => 3, :role_id => 3)
297 assert_equal source_t3, status_transitions(:tracker_id => 3, :role_id => 3)
298 end
298 end
299
299
300 def test_post_copy_with_incomplete_source_specification_should_fail
301 assert_no_difference 'WorkflowRule.count' do
302 post :copy,
303 :source_tracker_id => '', :source_role_id => '2',
304 :target_tracker_ids => ['2', '3'], :target_role_ids => ['1', '3']
305 assert_response 200
306 assert_select 'div.flash.error', :text => 'Please select a source tracker or role'
307 end
308 end
309
310 def test_post_copy_with_incomplete_target_specification_should_fail
311 assert_no_difference 'WorkflowRule.count' do
312 post :copy,
313 :source_tracker_id => '1', :source_role_id => '2',
314 :target_tracker_ids => ['2', '3']
315 assert_response 200
316 assert_select 'div.flash.error', :text => 'Please select target tracker(s) and role(s)'
317 end
318 end
319
300 # Returns an array of status transitions that can be compared
320 # Returns an array of status transitions that can be compared
301 def status_transitions(conditions)
321 def status_transitions(conditions)
302 WorkflowTransition.
322 WorkflowTransition.
General Comments 0
You need to be logged in to leave comments. Login now