summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-02-03 10:02:22 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-02-03 10:02:22 +0000
commit0afab2fb302e880930cc48b3ad16386222fe889e (patch)
tree1f1228144d1caf17895ef516cf2f9bbc76fe7526 /test/unit
parentca5c5d38d62f6dcdbff245dcd5f7db4bb8b4b6c8 (diff)
downloadredmine-0afab2fb302e880930cc48b3ad16386222fe889e.tar.gz
redmine-0afab2fb302e880930cc48b3ad16386222fe889e.zip
Removing shoulda context.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11318 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/query_test.rb105
1 files changed, 37 insertions, 68 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index 49e5cfc22..dfc291d7e 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -1025,81 +1025,50 @@ class QueryTest < ActiveSupport::TestCase
assert !query_ids.include?(7), 'public query on private project was visible'
end
- context "#available_filters" do
- setup do
- @query = IssueQuery.new(:name => "_")
- end
-
- should "include users of visible projects in cross-project view" do
- users = @query.available_filters["assigned_to_id"]
- assert_not_nil users
- assert users[:values].map{|u|u[1]}.include?("3")
- end
-
- should "include users of subprojects" do
- user1 = User.generate!
- user2 = User.generate!
- project = Project.find(1)
- Member.create!(:principal => user1, :project => project.children.visible.first, :role_ids => [1])
- @query.project = project
-
- users = @query.available_filters["assigned_to_id"]
- assert_not_nil users
- assert users[:values].map{|u|u[1]}.include?(user1.id.to_s)
- assert !users[:values].map{|u|u[1]}.include?(user2.id.to_s)
- end
-
- should "include visible projects in cross-project view" do
- projects = @query.available_filters["project_id"]
- assert_not_nil projects
- assert projects[:values].map{|u|u[1]}.include?("1")
- end
-
- context "'member_of_group' filter" do
- should "be present" do
- assert @query.available_filters.keys.include?("member_of_group")
- end
-
- should "be an optional list" do
- assert_equal :list_optional, @query.available_filters["member_of_group"][:type]
- end
-
- should "have a list of the groups as values" do
- Group.destroy_all # No fixtures
- group1 = Group.generate!.reload
- group2 = Group.generate!.reload
-
- expected_group_list = [
- [group1.name, group1.id.to_s],
- [group2.name, group2.id.to_s]
- ]
- assert_equal expected_group_list.sort, @query.available_filters["member_of_group"][:values].sort
- end
+ test "#available_filters should include users of visible projects in cross-project view" do
+ users = IssueQuery.new.available_filters["assigned_to_id"]
+ assert_not_nil users
+ assert users[:values].map{|u|u[1]}.include?("3")
+ end
- end
+ test "#available_filters should include users of subprojects" do
+ user1 = User.generate!
+ user2 = User.generate!
+ project = Project.find(1)
+ Member.create!(:principal => user1, :project => project.children.visible.first, :role_ids => [1])
- context "'assigned_to_role' filter" do
- should "be present" do
- assert @query.available_filters.keys.include?("assigned_to_role")
- end
+ users = IssueQuery.new(:project => project).available_filters["assigned_to_id"]
+ assert_not_nil users
+ assert users[:values].map{|u|u[1]}.include?(user1.id.to_s)
+ assert !users[:values].map{|u|u[1]}.include?(user2.id.to_s)
+ end
- should "be an optional list" do
- assert_equal :list_optional, @query.available_filters["assigned_to_role"][:type]
- end
+ test "#available_filters should include visible projects in cross-project view" do
+ projects = IssueQuery.new.available_filters["project_id"]
+ assert_not_nil projects
+ assert projects[:values].map{|u|u[1]}.include?("1")
+ end
- should "have a list of the Roles as values" do
- assert @query.available_filters["assigned_to_role"][:values].include?(['Manager','1'])
- assert @query.available_filters["assigned_to_role"][:values].include?(['Developer','2'])
- assert @query.available_filters["assigned_to_role"][:values].include?(['Reporter','3'])
- end
+ test "#available_filters should include 'member_of_group' filter" do
+ query = IssueQuery.new
+ assert query.available_filters.keys.include?("member_of_group")
+ assert_equal :list_optional, query.available_filters["member_of_group"][:type]
+ assert query.available_filters["member_of_group"][:values].present?
+ assert_equal Group.all.sort.map {|g| [g.name, g.id.to_s]},
+ query.available_filters["member_of_group"][:values].sort
+ end
- should "not include the built in Roles as values" do
- assert ! @query.available_filters["assigned_to_role"][:values].include?(['Non member','4'])
- assert ! @query.available_filters["assigned_to_role"][:values].include?(['Anonymous','5'])
- end
+ test "#available_filters should include 'assigned_to_role' filter" do
+ query = IssueQuery.new
+ assert query.available_filters.keys.include?("assigned_to_role")
+ assert_equal :list_optional, query.available_filters["assigned_to_role"][:type]
- end
+ assert query.available_filters["assigned_to_role"][:values].include?(['Manager','1'])
+ assert query.available_filters["assigned_to_role"][:values].include?(['Developer','2'])
+ assert query.available_filters["assigned_to_role"][:values].include?(['Reporter','3'])
+ assert ! query.available_filters["assigned_to_role"][:values].include?(['Non member','4'])
+ assert ! query.available_filters["assigned_to_role"][:values].include?(['Anonymous','5'])
end
context "#statement" do