##// END OF EJS Templates
Fix generation of blank local link when no title is specified in wiki link....
Fix generation of blank local link when no title is specified in wiki link. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7560 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r6805:c109046db7a9
r7440:ac2dbde135f7
Show More
queries_controller_test.rb
241 lines | 10.2 KiB | text/x-ruby | RubyLexer
/ test / functional / queries_controller_test.rb
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805 # Redmine - project management software
# Copyright (C) 2006-2011 Jean-Philippe Lang
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805 #
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805 #
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Baptiste Barth
Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050...
r4395 require File.expand_path('../../test_helper', __FILE__)
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 require 'queries_controller'
# Re-raise errors caught by the controller.
class QueriesController; def rescue_action(e) raise e end; end
Eric Davis
Upgraded to Rails 2.3.4 (#3597)...
r2773 class QueriesControllerTest < ActionController::TestCase
Jean-Philippe Lang
Allows multiple roles on the same project (#706). Prerequisite for user groups feature....
r2627 fixtures :projects, :users, :members, :member_roles, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values, :queries
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 def setup
@controller = QueriesController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
User.current = nil
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Global queries can be saved from the global issue list (follows r1311 and closes #897)....
r1297 def test_get_new_project_query
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 @request.session[:user_id] = 2
get :new, :project_id => 1
assert_response :success
assert_template 'new'
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query[is_public]',
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805 :checked => nil }
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query_is_for_all',
:checked => nil,
:disabled => nil }
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Global queries can be saved from the global issue list (follows r1311 and closes #897)....
r1297 def test_get_new_global_query
@request.session[:user_id] = 2
get :new
assert_response :success
assert_template 'new'
assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox',
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805 :name => 'query[is_public]' }
Jean-Philippe Lang
Global queries can be saved from the global issue list (follows r1311 and closes #897)....
r1297 assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query_is_for_all',
:checked => 'checked',
:disabled => nil }
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 def test_new_project_public_query
@request.session[:user_id] = 2
post :new,
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805 :project_id => 'ecookbook',
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 :confirm => '1',
:default_columns => '1',
Jean-Philippe Lang
Shortens filter param names....
r5159 :f => ["status_id", "assigned_to_id"],
:op => {"assigned_to_id" => "=", "status_id" => "o"},
:v => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
Jean-Philippe Lang
Global queries can be saved from the global issue list (follows r1311 and closes #897)....
r1297 :query => {"name" => "test_new_project_public_query", "is_public" => "1"}
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 q = Query.find_by_name('test_new_project_public_query')
Eric Davis
Upgraded to Rails 2.3.4 (#3597)...
r2773 assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 assert q.is_public?
assert q.has_default_columns?
assert q.valid?
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 def test_new_project_private_query
@request.session[:user_id] = 3
post :new,
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805 :project_id => 'ecookbook',
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 :confirm => '1',
:default_columns => '1',
:fields => ["status_id", "assigned_to_id"],
:operators => {"assigned_to_id" => "=", "status_id" => "o"},
:values => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
Jean-Philippe Lang
Global queries can be saved from the global issue list (follows r1311 and closes #897)....
r1297 :query => {"name" => "test_new_project_private_query", "is_public" => "1"}
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 q = Query.find_by_name('test_new_project_private_query')
Eric Davis
Upgraded to Rails 2.3.4 (#3597)...
r2773 assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 assert !q.is_public?
assert q.has_default_columns?
assert q.valid?
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Global queries can be saved from the global issue list (follows r1311 and closes #897)....
r1297 def test_new_global_private_query_with_custom_columns
@request.session[:user_id] = 3
post :new,
:confirm => '1',
:fields => ["status_id", "assigned_to_id"],
:operators => {"assigned_to_id" => "=", "status_id" => "o"},
:values => { "assigned_to_id" => ["me"], "status_id" => ["1"]},
Jean-Philippe Lang
Shorten query[column_names] param name....
r5184 :query => {"name" => "test_new_global_private_query", "is_public" => "1"},
:c => ["", "tracker", "subject", "priority", "category"]
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Global queries can be saved from the global issue list (follows r1311 and closes #897)....
r1297 q = Query.find_by_name('test_new_global_private_query')
Eric Davis
Upgraded to Rails 2.3.4 (#3597)...
r2773 assert_redirected_to :controller => 'issues', :action => 'index', :project_id => nil, :query_id => q
Jean-Philippe Lang
Global queries can be saved from the global issue list (follows r1311 and closes #897)....
r1297 assert !q.is_public?
assert !q.has_default_columns?
assert_equal [:tracker, :subject, :priority, :category], q.columns.collect {|c| c.name}
assert q.valid?
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Ability to save "sort order" in custom queries (#2899)....
r2504 def test_new_with_sort
@request.session[:user_id] = 1
post :new,
:confirm => '1',
:default_columns => '1',
:operators => {"status_id" => "o"},
:values => {"status_id" => ["1"]},
:query => {:name => "test_new_with_sort",
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805 :is_public => "1",
Jean-Philippe Lang
Ability to save "sort order" in custom queries (#2899)....
r2504 :sort_criteria => {"0" => ["due_date", "desc"], "1" => ["tracker", ""]}}
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Ability to save "sort order" in custom queries (#2899)....
r2504 query = Query.find_by_name("test_new_with_sort")
assert_not_nil query
assert_equal [['due_date', 'desc'], ['tracker', 'asc']], query.sort_criteria
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 def test_get_edit_global_public_query
@request.session[:user_id] = 1
get :edit, :id => 4
assert_response :success
assert_template 'edit'
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query[is_public]',
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805 :checked => 'checked' }
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query_is_for_all',
:checked => 'checked',
:disabled => 'disabled' }
end
def test_edit_global_public_query
@request.session[:user_id] = 1
post :edit,
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805 :id => 4,
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 :confirm => '1',
:default_columns => '1',
:fields => ["status_id", "assigned_to_id"],
:operators => {"assigned_to_id" => "=", "status_id" => "o"},
:values => { "assigned_to_id" => ["1"], "status_id" => ["1"]},
Jean-Philippe Lang
Global queries can be saved from the global issue list (follows r1311 and closes #897)....
r1297 :query => {"name" => "test_edit_global_public_query", "is_public" => "1"}
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 assert_redirected_to :controller => 'issues', :action => 'index', :query_id => 4
q = Query.find_by_name('test_edit_global_public_query')
assert q.is_public?
assert q.has_default_columns?
assert q.valid?
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 def test_get_edit_global_private_query
@request.session[:user_id] = 3
get :edit, :id => 3
assert_response :success
assert_template 'edit'
assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox',
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805 :name => 'query[is_public]' }
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query_is_for_all',
:checked => 'checked',
:disabled => 'disabled' }
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 def test_edit_global_private_query
@request.session[:user_id] = 3
post :edit,
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805 :id => 3,
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 :confirm => '1',
:default_columns => '1',
:fields => ["status_id", "assigned_to_id"],
:operators => {"assigned_to_id" => "=", "status_id" => "o"},
:values => { "assigned_to_id" => ["me"], "status_id" => ["1"]},
Jean-Philippe Lang
Global queries can be saved from the global issue list (follows r1311 and closes #897)....
r1297 :query => {"name" => "test_edit_global_private_query", "is_public" => "1"}
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 assert_redirected_to :controller => 'issues', :action => 'index', :query_id => 3
q = Query.find_by_name('test_edit_global_private_query')
assert !q.is_public?
assert q.has_default_columns?
assert q.valid?
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 def test_get_edit_project_private_query
@request.session[:user_id] = 3
get :edit, :id => 2
assert_response :success
assert_template 'edit'
assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox',
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805 :name => 'query[is_public]' }
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query_is_for_all',
:checked => nil,
:disabled => nil }
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 def test_get_edit_project_public_query
@request.session[:user_id] = 2
get :edit, :id => 1
assert_response :success
assert_template 'edit'
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query[is_public]',
:checked => 'checked'
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805 }
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query_is_for_all',
:checked => nil,
:disabled => 'disabled' }
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Ability to save "sort order" in custom queries (#2899)....
r2504 def test_get_edit_sort_criteria
@request.session[:user_id] = 1
get :edit, :id => 5
assert_response :success
assert_template 'edit'
assert_tag :tag => 'select', :attributes => { :name => 'query[sort_criteria][0][]' },
:child => { :tag => 'option', :attributes => { :value => 'priority',
:selected => 'selected' } }
assert_tag :tag => 'select', :attributes => { :name => 'query[sort_criteria][0][]' },
:child => { :tag => 'option', :attributes => { :value => 'desc',
:selected => 'selected' } }
end
Toshi MARUYAMA
remove trailing white-spaces from test/functional/queries_controller_test.rb....
r6805
Jean-Philippe Lang
Queries can be marked as 'For all projects'. Such queries will be available on all projects and on the global issue list (#897, closes #671)....
r1296 def test_destroy
@request.session[:user_id] = 2
post :destroy, :id => 1
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :set_filter => 1, :query_id => nil
assert_nil Query.find_by_id(1)
end
end