summaryrefslogtreecommitdiffstats
path: root/test/functional/queries_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-03-12 18:06:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-03-12 18:06:54 +0000
commitc7c8dc71f2fc8f224deb0a5340f7bbb8906e584d (patch)
treede3c8964542f8bb72cef67f462df910c4e6446f7 /test/functional/queries_controller_test.rb
parent2b585407cb66a26f81ea0bcb8a922dd1203e25e0 (diff)
downloadredmine-c7c8dc71f2fc8f224deb0a5340f7bbb8906e584d.tar.gz
redmine-c7c8dc71f2fc8f224deb0a5340f7bbb8906e584d.zip
Ability to save "sort order" in custom queries (#2899).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2572 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/queries_controller_test.rb')
-rw-r--r--test/functional/queries_controller_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb
index de08b4245..1951aff8f 100644
--- a/test/functional/queries_controller_test.rb
+++ b/test/functional/queries_controller_test.rb
@@ -111,6 +111,22 @@ class QueriesControllerTest < Test::Unit::TestCase
assert q.valid?
end
+ 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",
+ :is_public => "1",
+ :sort_criteria => {"0" => ["due_date", "desc"], "1" => ["tracker", ""]}}
+
+ query = Query.find_by_name("test_new_with_sort")
+ assert_not_nil query
+ assert_equal [['due_date', 'desc'], ['tracker', 'asc']], query.sort_criteria
+ end
+
def test_get_edit_global_public_query
@request.session[:user_id] = 1
get :edit, :id => 4
@@ -202,6 +218,19 @@ class QueriesControllerTest < Test::Unit::TestCase
:disabled => 'disabled' }
end
+ 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
+
def test_destroy
@request.session[:user_id] = 2
post :destroy, :id => 1