Mercurial > hg > soundsoftware-site
comparison test/unit/query_test.rb @ 119:8661b858af72
* Update to Redmine trunk rev 4705
author | Chris Cannam |
---|---|
date | Thu, 13 Jan 2011 14:12:06 +0000 |
parents | 94944d00e43c |
children | 051f544170fe |
comparison
equal
deleted
inserted
replaced
39:150ceac17a8d | 119:8661b858af72 |
---|---|
13 # | 13 # |
14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
15 # along with this program; if not, write to the Free Software | 15 # along with this program; if not, write to the Free Software |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | 17 |
18 require File.dirname(__FILE__) + '/../test_helper' | 18 require File.expand_path('../../test_helper', __FILE__) |
19 | 19 |
20 class QueryTest < ActiveSupport::TestCase | 20 class QueryTest < ActiveSupport::TestCase |
21 fixtures :projects, :enabled_modules, :users, :members, :member_roles, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :watchers, :custom_fields, :custom_values, :versions, :queries | 21 fixtures :projects, :enabled_modules, :users, :members, :member_roles, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :watchers, :custom_fields, :custom_values, :versions, :queries |
22 | 22 |
23 def test_custom_fields_for_all_projects_should_be_available_in_global_queries | 23 def test_custom_fields_for_all_projects_should_be_available_in_global_queries |
232 end | 232 end |
233 | 233 |
234 def test_groupable_columns_should_include_custom_fields | 234 def test_groupable_columns_should_include_custom_fields |
235 q = Query.new | 235 q = Query.new |
236 assert q.groupable_columns.detect {|c| c.is_a? QueryCustomFieldColumn} | 236 assert q.groupable_columns.detect {|c| c.is_a? QueryCustomFieldColumn} |
237 end | |
238 | |
239 def test_grouped_with_valid_column | |
240 q = Query.new(:group_by => 'status') | |
241 assert q.grouped? | |
242 assert_not_nil q.group_by_column | |
243 assert_equal :status, q.group_by_column.name | |
244 assert_not_nil q.group_by_statement | |
245 assert_equal 'status', q.group_by_statement | |
246 end | |
247 | |
248 def test_grouped_with_invalid_column | |
249 q = Query.new(:group_by => 'foo') | |
250 assert !q.grouped? | |
251 assert_nil q.group_by_column | |
252 assert_nil q.group_by_statement | |
237 end | 253 end |
238 | 254 |
239 def test_default_sort | 255 def test_default_sort |
240 q = Query.new | 256 q = Query.new |
241 assert_equal [], q.sort_criteria | 257 assert_equal [], q.sort_criteria |
378 | 394 |
379 should "include users of visible projects in cross-project view" do | 395 should "include users of visible projects in cross-project view" do |
380 users = @query.available_filters["assigned_to_id"] | 396 users = @query.available_filters["assigned_to_id"] |
381 assert_not_nil users | 397 assert_not_nil users |
382 assert users[:values].map{|u|u[1]}.include?("3") | 398 assert users[:values].map{|u|u[1]}.include?("3") |
399 end | |
400 | |
401 should "include visible projects in cross-project view" do | |
402 projects = @query.available_filters["project_id"] | |
403 assert_not_nil projects | |
404 assert projects[:values].map{|u|u[1]}.include?("1") | |
383 end | 405 end |
384 | 406 |
385 context "'member_of_group' filter" do | 407 context "'member_of_group' filter" do |
386 should "be present" do | 408 should "be present" do |
387 assert @query.available_filters.keys.include?("member_of_group") | 409 assert @query.available_filters.keys.include?("member_of_group") |