Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10987 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
5dd7467061
commit
24be0551cc
|
@ -37,7 +37,6 @@ class QueriesController < ApplicationController
|
||||||
@queries = IssueQuery.visible.all(:limit => @limit, :offset => @offset, :order => "#{Query.table_name}.name")
|
@queries = IssueQuery.visible.all(:limit => @limit, :offset => @offset, :order => "#{Query.table_name}.name")
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :nothing => true }
|
|
||||||
format.api
|
format.api
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -106,7 +106,7 @@ class WorkflowsController < ApplicationController
|
||||||
if request.post?
|
if request.post?
|
||||||
if params[:source_tracker_id].blank? || params[:source_role_id].blank? || (@source_tracker.nil? && @source_role.nil?)
|
if params[:source_tracker_id].blank? || params[:source_role_id].blank? || (@source_tracker.nil? && @source_role.nil?)
|
||||||
flash.now[:error] = l(:error_workflow_copy_source)
|
flash.now[:error] = l(:error_workflow_copy_source)
|
||||||
elsif @target_trackers.nil? || @target_roles.nil?
|
elsif @target_trackers.blank? || @target_roles.blank?
|
||||||
flash.now[:error] = l(:error_workflow_copy_target)
|
flash.now[:error] = l(:error_workflow_copy_target)
|
||||||
else
|
else
|
||||||
WorkflowRule.copy(@source_tracker, @source_role, @target_trackers, @target_roles)
|
WorkflowRule.copy(@source_tracker, @source_role, @target_trackers, @target_roles)
|
||||||
|
|
|
@ -81,6 +81,12 @@ class MessagesControllerTest < ActionController::TestCase
|
||||||
assert_template 'new'
|
assert_template 'new'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_get_new_with_invalid_board
|
||||||
|
@request.session[:user_id] = 2
|
||||||
|
get :new, :board_id => 99
|
||||||
|
assert_response 404
|
||||||
|
end
|
||||||
|
|
||||||
def test_post_new
|
def test_post_new
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
|
|
|
@ -24,6 +24,12 @@ class QueriesControllerTest < ActionController::TestCase
|
||||||
User.current = nil
|
User.current = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_index
|
||||||
|
get :index
|
||||||
|
# HTML response not implemented
|
||||||
|
assert_response 406
|
||||||
|
end
|
||||||
|
|
||||||
def test_new_project_query
|
def test_new_project_query
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
get :new, :project_id => 1
|
get :new, :project_id => 1
|
||||||
|
|
|
@ -297,6 +297,26 @@ class WorkflowsControllerTest < ActionController::TestCase
|
||||||
assert_equal source_t3, status_transitions(:tracker_id => 3, :role_id => 3)
|
assert_equal source_t3, status_transitions(:tracker_id => 3, :role_id => 3)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_post_copy_with_incomplete_source_specification_should_fail
|
||||||
|
assert_no_difference 'WorkflowRule.count' do
|
||||||
|
post :copy,
|
||||||
|
:source_tracker_id => '', :source_role_id => '2',
|
||||||
|
:target_tracker_ids => ['2', '3'], :target_role_ids => ['1', '3']
|
||||||
|
assert_response 200
|
||||||
|
assert_select 'div.flash.error', :text => 'Please select a source tracker or role'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_post_copy_with_incomplete_target_specification_should_fail
|
||||||
|
assert_no_difference 'WorkflowRule.count' do
|
||||||
|
post :copy,
|
||||||
|
:source_tracker_id => '1', :source_role_id => '2',
|
||||||
|
:target_tracker_ids => ['2', '3']
|
||||||
|
assert_response 200
|
||||||
|
assert_select 'div.flash.error', :text => 'Please select target tracker(s) and role(s)'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Returns an array of status transitions that can be compared
|
# Returns an array of status transitions that can be compared
|
||||||
def status_transitions(conditions)
|
def status_transitions(conditions)
|
||||||
WorkflowTransition.
|
WorkflowTransition.
|
||||||
|
|
Loading…
Reference in New Issue