comparison test/unit/custom_field_version_format_test.rb @ 1526:404aa68d4227

Merge from live branch
author Chris Cannam
date Thu, 11 Sep 2014 12:46:20 +0100
parents dffacf8a6908
children
comparison
equal deleted inserted replaced
1493:a5f2bdf3b486 1526:404aa68d4227
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
20 class CustomFieldVersionFormatTest < ActiveSupport::TestCase 20 class CustomFieldVersionFormatTest < ActiveSupport::TestCase
21 fixtures :custom_fields, :projects, :members, :users, :member_roles, :trackers, :issues, :versions 21 fixtures :custom_fields, :projects, :members, :users, :member_roles, :trackers, :issues, :versions
22 22
23 def setup 23 def setup
24 @field = IssueCustomField.create!(:name => 'Tester', :field_format => 'version') 24 @field = IssueCustomField.create!(:name => 'Tester', :field_format => 'version')
25 end
26
27 def test_possible_values_with_no_arguments
28 assert_equal [], @field.possible_values
29 assert_equal [], @field.possible_values(nil)
30 end
31
32 def test_possible_values_with_project_resource
33 project = Project.find(1)
34 possible_values = @field.possible_values(project.issues.first)
35 assert possible_values.any?
36 assert_equal project.shared_versions.sort.collect(&:id).map(&:to_s), possible_values
37 end
38
39 def test_possible_values_with_nil_project_resource
40 assert_equal [], @field.possible_values(Issue.new)
41 end 25 end
42 26
43 def test_possible_values_options_with_no_arguments 27 def test_possible_values_options_with_no_arguments
44 assert_equal [], @field.possible_values_options 28 assert_equal [], @field.possible_values_options
45 assert_equal [], @field.possible_values_options(nil) 29 assert_equal [], @field.possible_values_options(nil)