remove trailing white-spaces from test/functional/queries_controller_test.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6925 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
1fe58f503c
commit
c109046db7
@ -1,16 +1,16 @@
|
|||||||
# redMine - project management software
|
# Redmine - project management software
|
||||||
# Copyright (C) 2006-2008 Jean-Philippe Lang
|
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
# as published by the Free Software Foundation; either version 2
|
# as published by the Free Software Foundation; either version 2
|
||||||
# of the License, or (at your option) any later version.
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
@ -23,14 +23,14 @@ class QueriesController; def rescue_action(e) raise e end; end
|
|||||||
|
|
||||||
class QueriesControllerTest < ActionController::TestCase
|
class QueriesControllerTest < ActionController::TestCase
|
||||||
fixtures :projects, :users, :members, :member_roles, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values, :queries
|
fixtures :projects, :users, :members, :member_roles, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values, :queries
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@controller = QueriesController.new
|
@controller = QueriesController.new
|
||||||
@request = ActionController::TestRequest.new
|
@request = ActionController::TestRequest.new
|
||||||
@response = ActionController::TestResponse.new
|
@response = ActionController::TestResponse.new
|
||||||
User.current = nil
|
User.current = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_get_new_project_query
|
def test_get_new_project_query
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
get :new, :project_id => 1
|
get :new, :project_id => 1
|
||||||
@ -38,62 +38,62 @@ class QueriesControllerTest < ActionController::TestCase
|
|||||||
assert_template 'new'
|
assert_template 'new'
|
||||||
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
||||||
:name => 'query[is_public]',
|
:name => 'query[is_public]',
|
||||||
:checked => nil }
|
:checked => nil }
|
||||||
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
||||||
:name => 'query_is_for_all',
|
:name => 'query_is_for_all',
|
||||||
:checked => nil,
|
:checked => nil,
|
||||||
:disabled => nil }
|
:disabled => nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_get_new_global_query
|
def test_get_new_global_query
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
get :new
|
get :new
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'new'
|
assert_template 'new'
|
||||||
assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
||||||
:name => 'query[is_public]' }
|
:name => 'query[is_public]' }
|
||||||
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
||||||
:name => 'query_is_for_all',
|
:name => 'query_is_for_all',
|
||||||
:checked => 'checked',
|
:checked => 'checked',
|
||||||
:disabled => nil }
|
:disabled => nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_new_project_public_query
|
def test_new_project_public_query
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
post :new,
|
post :new,
|
||||||
:project_id => 'ecookbook',
|
:project_id => 'ecookbook',
|
||||||
:confirm => '1',
|
:confirm => '1',
|
||||||
:default_columns => '1',
|
:default_columns => '1',
|
||||||
:f => ["status_id", "assigned_to_id"],
|
:f => ["status_id", "assigned_to_id"],
|
||||||
:op => {"assigned_to_id" => "=", "status_id" => "o"},
|
:op => {"assigned_to_id" => "=", "status_id" => "o"},
|
||||||
:v => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
|
:v => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
|
||||||
:query => {"name" => "test_new_project_public_query", "is_public" => "1"}
|
:query => {"name" => "test_new_project_public_query", "is_public" => "1"}
|
||||||
|
|
||||||
q = Query.find_by_name('test_new_project_public_query')
|
q = Query.find_by_name('test_new_project_public_query')
|
||||||
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q
|
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q
|
||||||
assert q.is_public?
|
assert q.is_public?
|
||||||
assert q.has_default_columns?
|
assert q.has_default_columns?
|
||||||
assert q.valid?
|
assert q.valid?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_new_project_private_query
|
def test_new_project_private_query
|
||||||
@request.session[:user_id] = 3
|
@request.session[:user_id] = 3
|
||||||
post :new,
|
post :new,
|
||||||
:project_id => 'ecookbook',
|
:project_id => 'ecookbook',
|
||||||
:confirm => '1',
|
:confirm => '1',
|
||||||
:default_columns => '1',
|
:default_columns => '1',
|
||||||
:fields => ["status_id", "assigned_to_id"],
|
:fields => ["status_id", "assigned_to_id"],
|
||||||
:operators => {"assigned_to_id" => "=", "status_id" => "o"},
|
:operators => {"assigned_to_id" => "=", "status_id" => "o"},
|
||||||
:values => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
|
:values => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
|
||||||
:query => {"name" => "test_new_project_private_query", "is_public" => "1"}
|
:query => {"name" => "test_new_project_private_query", "is_public" => "1"}
|
||||||
|
|
||||||
q = Query.find_by_name('test_new_project_private_query')
|
q = Query.find_by_name('test_new_project_private_query')
|
||||||
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q
|
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q
|
||||||
assert !q.is_public?
|
assert !q.is_public?
|
||||||
assert q.has_default_columns?
|
assert q.has_default_columns?
|
||||||
assert q.valid?
|
assert q.valid?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_new_global_private_query_with_custom_columns
|
def test_new_global_private_query_with_custom_columns
|
||||||
@request.session[:user_id] = 3
|
@request.session[:user_id] = 3
|
||||||
post :new,
|
post :new,
|
||||||
@ -103,7 +103,7 @@ class QueriesControllerTest < ActionController::TestCase
|
|||||||
:values => { "assigned_to_id" => ["me"], "status_id" => ["1"]},
|
:values => { "assigned_to_id" => ["me"], "status_id" => ["1"]},
|
||||||
:query => {"name" => "test_new_global_private_query", "is_public" => "1"},
|
:query => {"name" => "test_new_global_private_query", "is_public" => "1"},
|
||||||
:c => ["", "tracker", "subject", "priority", "category"]
|
:c => ["", "tracker", "subject", "priority", "category"]
|
||||||
|
|
||||||
q = Query.find_by_name('test_new_global_private_query')
|
q = Query.find_by_name('test_new_global_private_query')
|
||||||
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => nil, :query_id => q
|
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => nil, :query_id => q
|
||||||
assert !q.is_public?
|
assert !q.is_public?
|
||||||
@ -111,7 +111,7 @@ class QueriesControllerTest < ActionController::TestCase
|
|||||||
assert_equal [:tracker, :subject, :priority, :category], q.columns.collect {|c| c.name}
|
assert_equal [:tracker, :subject, :priority, :category], q.columns.collect {|c| c.name}
|
||||||
assert q.valid?
|
assert q.valid?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_new_with_sort
|
def test_new_with_sort
|
||||||
@request.session[:user_id] = 1
|
@request.session[:user_id] = 1
|
||||||
post :new,
|
post :new,
|
||||||
@ -120,14 +120,14 @@ class QueriesControllerTest < ActionController::TestCase
|
|||||||
:operators => {"status_id" => "o"},
|
:operators => {"status_id" => "o"},
|
||||||
:values => {"status_id" => ["1"]},
|
:values => {"status_id" => ["1"]},
|
||||||
:query => {:name => "test_new_with_sort",
|
:query => {:name => "test_new_with_sort",
|
||||||
:is_public => "1",
|
:is_public => "1",
|
||||||
:sort_criteria => {"0" => ["due_date", "desc"], "1" => ["tracker", ""]}}
|
:sort_criteria => {"0" => ["due_date", "desc"], "1" => ["tracker", ""]}}
|
||||||
|
|
||||||
query = Query.find_by_name("test_new_with_sort")
|
query = Query.find_by_name("test_new_with_sort")
|
||||||
assert_not_nil query
|
assert_not_nil query
|
||||||
assert_equal [['due_date', 'desc'], ['tracker', 'asc']], query.sort_criteria
|
assert_equal [['due_date', 'desc'], ['tracker', 'asc']], query.sort_criteria
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_get_edit_global_public_query
|
def test_get_edit_global_public_query
|
||||||
@request.session[:user_id] = 1
|
@request.session[:user_id] = 1
|
||||||
get :edit, :id => 4
|
get :edit, :id => 4
|
||||||
@ -135,7 +135,7 @@ class QueriesControllerTest < ActionController::TestCase
|
|||||||
assert_template 'edit'
|
assert_template 'edit'
|
||||||
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
||||||
:name => 'query[is_public]',
|
:name => 'query[is_public]',
|
||||||
:checked => 'checked' }
|
:checked => 'checked' }
|
||||||
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
||||||
:name => 'query_is_for_all',
|
:name => 'query_is_for_all',
|
||||||
:checked => 'checked',
|
:checked => 'checked',
|
||||||
@ -145,65 +145,65 @@ class QueriesControllerTest < ActionController::TestCase
|
|||||||
def test_edit_global_public_query
|
def test_edit_global_public_query
|
||||||
@request.session[:user_id] = 1
|
@request.session[:user_id] = 1
|
||||||
post :edit,
|
post :edit,
|
||||||
:id => 4,
|
:id => 4,
|
||||||
:confirm => '1',
|
:confirm => '1',
|
||||||
:default_columns => '1',
|
:default_columns => '1',
|
||||||
:fields => ["status_id", "assigned_to_id"],
|
:fields => ["status_id", "assigned_to_id"],
|
||||||
:operators => {"assigned_to_id" => "=", "status_id" => "o"},
|
:operators => {"assigned_to_id" => "=", "status_id" => "o"},
|
||||||
:values => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
|
:values => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
|
||||||
:query => {"name" => "test_edit_global_public_query", "is_public" => "1"}
|
:query => {"name" => "test_edit_global_public_query", "is_public" => "1"}
|
||||||
|
|
||||||
assert_redirected_to :controller => 'issues', :action => 'index', :query_id => 4
|
assert_redirected_to :controller => 'issues', :action => 'index', :query_id => 4
|
||||||
q = Query.find_by_name('test_edit_global_public_query')
|
q = Query.find_by_name('test_edit_global_public_query')
|
||||||
assert q.is_public?
|
assert q.is_public?
|
||||||
assert q.has_default_columns?
|
assert q.has_default_columns?
|
||||||
assert q.valid?
|
assert q.valid?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_get_edit_global_private_query
|
def test_get_edit_global_private_query
|
||||||
@request.session[:user_id] = 3
|
@request.session[:user_id] = 3
|
||||||
get :edit, :id => 3
|
get :edit, :id => 3
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'edit'
|
assert_template 'edit'
|
||||||
assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
||||||
:name => 'query[is_public]' }
|
:name => 'query[is_public]' }
|
||||||
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
||||||
:name => 'query_is_for_all',
|
:name => 'query_is_for_all',
|
||||||
:checked => 'checked',
|
:checked => 'checked',
|
||||||
:disabled => 'disabled' }
|
:disabled => 'disabled' }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_edit_global_private_query
|
def test_edit_global_private_query
|
||||||
@request.session[:user_id] = 3
|
@request.session[:user_id] = 3
|
||||||
post :edit,
|
post :edit,
|
||||||
:id => 3,
|
:id => 3,
|
||||||
:confirm => '1',
|
:confirm => '1',
|
||||||
:default_columns => '1',
|
:default_columns => '1',
|
||||||
:fields => ["status_id", "assigned_to_id"],
|
:fields => ["status_id", "assigned_to_id"],
|
||||||
:operators => {"assigned_to_id" => "=", "status_id" => "o"},
|
:operators => {"assigned_to_id" => "=", "status_id" => "o"},
|
||||||
:values => { "assigned_to_id" => ["me"], "status_id" => ["1"]},
|
:values => { "assigned_to_id" => ["me"], "status_id" => ["1"]},
|
||||||
:query => {"name" => "test_edit_global_private_query", "is_public" => "1"}
|
:query => {"name" => "test_edit_global_private_query", "is_public" => "1"}
|
||||||
|
|
||||||
assert_redirected_to :controller => 'issues', :action => 'index', :query_id => 3
|
assert_redirected_to :controller => 'issues', :action => 'index', :query_id => 3
|
||||||
q = Query.find_by_name('test_edit_global_private_query')
|
q = Query.find_by_name('test_edit_global_private_query')
|
||||||
assert !q.is_public?
|
assert !q.is_public?
|
||||||
assert q.has_default_columns?
|
assert q.has_default_columns?
|
||||||
assert q.valid?
|
assert q.valid?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_get_edit_project_private_query
|
def test_get_edit_project_private_query
|
||||||
@request.session[:user_id] = 3
|
@request.session[:user_id] = 3
|
||||||
get :edit, :id => 2
|
get :edit, :id => 2
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'edit'
|
assert_template 'edit'
|
||||||
assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
||||||
:name => 'query[is_public]' }
|
:name => 'query[is_public]' }
|
||||||
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
||||||
:name => 'query_is_for_all',
|
:name => 'query_is_for_all',
|
||||||
:checked => nil,
|
:checked => nil,
|
||||||
:disabled => nil }
|
:disabled => nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_get_edit_project_public_query
|
def test_get_edit_project_public_query
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
get :edit, :id => 1
|
get :edit, :id => 1
|
||||||
@ -212,13 +212,13 @@ class QueriesControllerTest < ActionController::TestCase
|
|||||||
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
||||||
:name => 'query[is_public]',
|
:name => 'query[is_public]',
|
||||||
:checked => 'checked'
|
:checked => 'checked'
|
||||||
}
|
}
|
||||||
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
||||||
:name => 'query_is_for_all',
|
:name => 'query_is_for_all',
|
||||||
:checked => nil,
|
:checked => nil,
|
||||||
:disabled => 'disabled' }
|
:disabled => 'disabled' }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_get_edit_sort_criteria
|
def test_get_edit_sort_criteria
|
||||||
@request.session[:user_id] = 1
|
@request.session[:user_id] = 1
|
||||||
get :edit, :id => 5
|
get :edit, :id => 5
|
||||||
@ -231,7 +231,7 @@ class QueriesControllerTest < ActionController::TestCase
|
|||||||
:child => { :tag => 'option', :attributes => { :value => 'desc',
|
:child => { :tag => 'option', :attributes => { :value => 'desc',
|
||||||
:selected => 'selected' } }
|
:selected => 'selected' } }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_destroy
|
def test_destroy
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
post :destroy, :id => 1
|
post :destroy, :id => 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user