Redmine 4.1.1
This commit is contained in:
parent
33e7b881a5
commit
3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -25,6 +27,7 @@ class Redmine::AttachmentFieldFormatTest < ActionView::TestCase
|
|||
fixtures :users
|
||||
|
||||
def setup
|
||||
User.current = nil
|
||||
set_language_if_valid 'en'
|
||||
set_tmp_attachments_directory
|
||||
end
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -23,6 +25,7 @@ class AttachmentFormatVisibilityTest < ActionView::TestCase
|
|||
:roles, :members, :member_roles,
|
||||
:users, :email_addresses,
|
||||
:trackers, :issue_statuses, :enumerations, :issue_categories,
|
||||
:custom_fields, :custom_fields_trackers,
|
||||
:versions, :issues
|
||||
|
||||
def setup
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -73,7 +75,7 @@ class Redmine::FieldFormatTest < ActionView::TestCase
|
|||
custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "bar")
|
||||
|
||||
assert_equal "bar", field.format.formatted_custom_value(self, custom_value, false)
|
||||
assert_equal '<a href="http://foo/bar">bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
assert_equal '<a class="external" href="http://foo/bar">bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
end
|
||||
|
||||
def test_text_field_with_url_pattern_and_value_containing_a_space_should_format_as_link
|
||||
|
@ -81,7 +83,7 @@ class Redmine::FieldFormatTest < ActionView::TestCase
|
|||
custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "foo bar")
|
||||
|
||||
assert_equal "foo bar", field.format.formatted_custom_value(self, custom_value, false)
|
||||
assert_equal '<a href="http://foo/foo%20bar">foo bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
assert_equal '<a class="external" href="http://foo/foo%20bar">foo bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
end
|
||||
|
||||
def test_text_field_with_url_pattern_should_not_encode_url_pattern
|
||||
|
@ -89,7 +91,7 @@ class Redmine::FieldFormatTest < ActionView::TestCase
|
|||
custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "1")
|
||||
|
||||
assert_equal "1", field.format.formatted_custom_value(self, custom_value, false)
|
||||
assert_equal '<a href="http://foo/bar#anchor">1</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
assert_equal '<a class="external" href="http://foo/bar#anchor">1</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
end
|
||||
|
||||
def test_text_field_with_url_pattern_should_encode_values
|
||||
|
@ -97,6 +99,6 @@ class Redmine::FieldFormatTest < ActionView::TestCase
|
|||
custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "foo bar")
|
||||
|
||||
assert_equal "foo bar", field.format.formatted_custom_value(self, custom_value, false)
|
||||
assert_equal '<a href="http://foo/foo%20bar#anchor">foo bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
assert_equal '<a class="external" href="http://foo/foo%20bar#anchor">foo bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -29,7 +31,7 @@ class Redmine::LinkFieldFormatTest < ActionView::TestCase
|
|||
custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "bar")
|
||||
|
||||
assert_equal "bar", field.format.formatted_custom_value(self, custom_value, false)
|
||||
assert_equal '<a href="http://foo/bar">bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
assert_equal '<a class="external" href="http://foo/bar">bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
end
|
||||
|
||||
def test_link_field_should_substitute_object_id_in_url
|
||||
|
@ -40,7 +42,7 @@ class Redmine::LinkFieldFormatTest < ActionView::TestCase
|
|||
custom_value = CustomValue.new(:custom_field => field, :customized => object, :value => "bar")
|
||||
|
||||
assert_equal "bar", field.format.formatted_custom_value(self, custom_value, false)
|
||||
assert_equal '<a href="http://foo/10">bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
assert_equal '<a class="external" href="http://foo/10">bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
end
|
||||
|
||||
def test_link_field_should_substitute_project_id_in_url
|
||||
|
@ -53,7 +55,7 @@ class Redmine::LinkFieldFormatTest < ActionView::TestCase
|
|||
custom_value = CustomValue.new(:custom_field => field, :customized => object, :value => "bar")
|
||||
|
||||
assert_equal "bar", field.format.formatted_custom_value(self, custom_value, false)
|
||||
assert_equal '<a href="http://foo/52">bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
assert_equal '<a class="external" href="http://foo/52">bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
end
|
||||
|
||||
def test_link_field_should_substitute_project_identifier_in_url
|
||||
|
@ -66,7 +68,7 @@ class Redmine::LinkFieldFormatTest < ActionView::TestCase
|
|||
custom_value = CustomValue.new(:custom_field => field, :customized => object, :value => "bar")
|
||||
|
||||
assert_equal "bar", field.format.formatted_custom_value(self, custom_value, false)
|
||||
assert_equal '<a href="http://foo/foo_project-00">bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
assert_equal '<a class="external" href="http://foo/foo_project-00">bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
end
|
||||
|
||||
def test_link_field_should_substitute_regexp_groups
|
||||
|
@ -74,7 +76,7 @@ class Redmine::LinkFieldFormatTest < ActionView::TestCase
|
|||
custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "56-142")
|
||||
|
||||
assert_equal "56-142", field.format.formatted_custom_value(self, custom_value, false)
|
||||
assert_equal '<a href="http://foo/142/56">56-142</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
assert_equal '<a class="external" href="http://foo/142/56">56-142</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
end
|
||||
|
||||
def test_link_field_without_url_pattern_should_link_to_value
|
||||
|
@ -82,7 +84,7 @@ class Redmine::LinkFieldFormatTest < ActionView::TestCase
|
|||
custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "http://foo/bar")
|
||||
|
||||
assert_equal "http://foo/bar", field.format.formatted_custom_value(self, custom_value, false)
|
||||
assert_equal '<a href="http://foo/bar">http://foo/bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
assert_equal '<a class="external" href="http://foo/bar">http://foo/bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
end
|
||||
|
||||
def test_link_field_without_url_pattern_should_link_to_value_with_http_by_default
|
||||
|
@ -90,6 +92,6 @@ class Redmine::LinkFieldFormatTest < ActionView::TestCase
|
|||
custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "foo.bar")
|
||||
|
||||
assert_equal "foo.bar", field.format.formatted_custom_value(self, custom_value, false)
|
||||
assert_equal '<a href="http://foo.bar">foo.bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
assert_equal '<a class="external" href="http://foo.bar">foo.bar</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -142,14 +144,14 @@ class Redmine::ListFieldFormatTest < ActionView::TestCase
|
|||
def test_field_with_url_pattern_should_link_value
|
||||
field = IssueCustomField.new(:field_format => 'list', :url_pattern => 'http://localhost/%value%')
|
||||
formatted = field.format.formatted_value(self, field, 'foo', Issue.new, true)
|
||||
assert_equal '<a href="http://localhost/foo">foo</a>', formatted
|
||||
assert_equal '<a class="external" href="http://localhost/foo">foo</a>', formatted
|
||||
assert formatted.html_safe?
|
||||
end
|
||||
|
||||
def test_field_with_url_pattern_and_multiple_values_should_link_values
|
||||
field = IssueCustomField.new(:field_format => 'list', :url_pattern => 'http://localhost/%value%')
|
||||
formatted = field.format.formatted_value(self, field, ['foo', 'bar'], Issue.new, true)
|
||||
assert_equal '<a href="http://localhost/bar">bar</a>, <a href="http://localhost/foo">foo</a>', formatted
|
||||
assert_equal '<a class="external" href="http://localhost/bar">bar</a>, <a class="external" href="http://localhost/foo">foo</a>', formatted
|
||||
assert formatted.html_safe?
|
||||
end
|
||||
|
||||
|
|
|
@ -1,35 +1,37 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
|
||||
require File.expand_path('../../../../../test_helper', __FILE__)
|
||||
require 'redmine/field_format'
|
||||
|
||||
class Redmine::NumericFieldFormatTest < ActionView::TestCase
|
||||
include ApplicationHelper
|
||||
|
||||
def setup
|
||||
User.current = nil
|
||||
end
|
||||
|
||||
def test_integer_field_with_url_pattern_should_format_as_link
|
||||
field = IssueCustomField.new(:field_format => 'int', :url_pattern => 'http://foo/%value%')
|
||||
custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "3")
|
||||
|
||||
assert_equal 3, field.format.formatted_custom_value(self, custom_value, false)
|
||||
assert_equal '<a href="http://foo/3">3</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
end
|
||||
end
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
|
||||
require File.expand_path('../../../../../test_helper', __FILE__)
|
||||
require 'redmine/field_format'
|
||||
|
||||
class Redmine::NumericFieldFormatTest < ActionView::TestCase
|
||||
include ApplicationHelper
|
||||
|
||||
def setup
|
||||
User.current = nil
|
||||
end
|
||||
|
||||
def test_integer_field_with_url_pattern_should_format_as_link
|
||||
field = IssueCustomField.new(:field_format => 'int', :url_pattern => 'http://foo/%value%')
|
||||
custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "3")
|
||||
|
||||
assert_equal 3, field.format.formatted_custom_value(self, custom_value, false)
|
||||
assert_equal '<a class="external" href="http://foo/3">3</a>', field.format.formatted_custom_value(self, custom_value, true)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -22,7 +24,8 @@ class Redmine::UserFieldFormatTest < ActionView::TestCase
|
|||
fixtures :projects, :roles, :users, :members, :member_roles,
|
||||
:trackers,
|
||||
:issue_statuses, :issue_categories, :issue_relations, :workflows,
|
||||
:enumerations
|
||||
:enumerations,
|
||||
:custom_fields, :custom_fields_trackers, :custom_fields_projects
|
||||
|
||||
def setup
|
||||
User.current = nil
|
||||
|
@ -78,6 +81,15 @@ class Redmine::UserFieldFormatTest < ActionView::TestCase
|
|||
assert_equal ['Dave Lopper'], field.possible_values_options(project).map(&:first)
|
||||
end
|
||||
|
||||
def test_possible_values_options_should_return_project_members_and_me_if_logged_in
|
||||
::I18n.locale = 'en'
|
||||
User.current = User.find(2)
|
||||
field = IssueCustomField.new(:field_format => 'user')
|
||||
project = Project.find(1)
|
||||
|
||||
assert_equal ['<< me >>', 'Dave Lopper', 'John Smith'], field.possible_values_options(project).map(&:first)
|
||||
end
|
||||
|
||||
def test_value_from_keyword_should_return_user_id
|
||||
field = IssueCustomField.new(:field_format => 'user')
|
||||
project = Project.find(1)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -22,7 +24,8 @@ class Redmine::VersionFieldFormatTest < ActionView::TestCase
|
|||
fixtures :projects, :versions, :trackers,
|
||||
:roles, :users, :members, :member_roles,
|
||||
:issue_statuses, :issue_categories, :issue_relations, :workflows,
|
||||
:enumerations
|
||||
:enumerations, :custom_fields, :custom_fields_trackers,
|
||||
:enabled_modules
|
||||
|
||||
def setup
|
||||
super
|
||||
|
@ -70,7 +73,7 @@ class Redmine::VersionFieldFormatTest < ActionView::TestCase
|
|||
|
||||
assert_equal expected, field.possible_values_options(project).map(&:first)
|
||||
end
|
||||
|
||||
|
||||
def test_possible_values_options_should_return_system_shared_versions_without_project
|
||||
field = IssueCustomField.new(:field_format => 'version')
|
||||
version = Version.generate!(:project => Project.find(1), :status => 'open', :sharing => 'system')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue