redmine_extensions 0.1.15 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/redmine_extensions/entity/entity_generator.rb +21 -24
- data/lib/generators/redmine_extensions/entity/templates/_form.html.erb.erb +4 -0
- data/lib/generators/redmine_extensions/entity/templates/_sidebar.html.erb.erb +1 -1
- data/lib/generators/redmine_extensions/entity/templates/context_menu.html.erb.erb +1 -1
- data/lib/generators/redmine_extensions/entity/templates/controller.rb.erb +19 -16
- data/lib/generators/redmine_extensions/entity/templates/custom_field.rb.erb +7 -7
- data/lib/generators/redmine_extensions/entity/templates/edit.js.erb.erb +10 -9
- data/lib/generators/redmine_extensions/entity/templates/en.yml.erb +1 -2
- data/lib/generators/redmine_extensions/entity/templates/index.api.rsb.erb +5 -5
- data/lib/generators/redmine_extensions/entity/templates/index.html.erb.erb +2 -0
- data/lib/generators/redmine_extensions/entity/templates/index.js.erb.erb +7 -6
- data/lib/generators/redmine_extensions/entity/templates/mail_added.html.erb.erb +1 -1
- data/lib/generators/redmine_extensions/entity/templates/mail_added.text.erb.erb +2 -2
- data/lib/generators/redmine_extensions/entity/templates/mail_updated.text.erb.erb +2 -2
- data/lib/generators/redmine_extensions/entity/templates/migration.rb.erb +3 -1
- data/lib/generators/redmine_extensions/entity/templates/model.rb.erb +4 -4
- data/lib/generators/redmine_extensions/entity/templates/new.js.erb.erb +10 -9
- data/lib/generators/redmine_extensions/entity/templates/query.rb.erb +8 -5
- data/lib/generators/redmine_extensions/entity/templates/routes.rb.erb +12 -12
- data/lib/generators/redmine_extensions/entity/templates/show.html.erb.erb +37 -37
- data/lib/generators/redmine_extensions/entity/templates/show.js.erb.erb +7 -6
- data/lib/generators/redmine_extensions/plugin/plugin_generator.rb +3 -1
- data/lib/generators/redmine_extensions/plugin/templates/after_init.rb.erb +22 -0
- data/lib/generators/redmine_extensions/plugin/templates/init.rb.erb +4 -22
- data/lib/generators/redmine_extensions/plugin/templates/javascript.js +1 -0
- data/lib/generators/redmine_extensions/plugin/templates/stylesheet.css +3 -0
- data/lib/redmine_extensions/version.rb +1 -1
- metadata +12 -216
- data/app/assets/javascripts/redmine_extensions/redmine_extensions.js.orig +0 -648
- data/app/views/easy_entity_assignments/_query_index.html.erb.orig +0 -16
- data/lib/redmine_extensions/redmine_patches/controllers/issues_controller_patch.rb +0 -9
- data/lib/redmine_extensions/version.rb.orig +0 -7
- data/spec/redmine/app/controllers/custom_field_enumerations_controller.rb +0 -75
- data/spec/redmine/app/controllers/imports_controller.rb +0 -121
- data/spec/redmine/app/helpers/imports_helper.rb +0 -47
- data/spec/redmine/app/models/custom_field_enumeration.rb +0 -90
- data/spec/redmine/app/models/import.rb +0 -249
- data/spec/redmine/app/models/import_item.rb +0 -22
- data/spec/redmine/app/models/issue_import.rb +0 -186
- data/spec/redmine/app/views/attachments/image.html.erb +0 -3
- data/spec/redmine/app/views/attachments/other.html.erb +0 -3
- data/spec/redmine/app/views/common/_image.html.erb +0 -1
- data/spec/redmine/app/views/common/_other.html.erb +0 -1
- data/spec/redmine/app/views/custom_field_enumerations/create.js.erb +0 -2
- data/spec/redmine/app/views/custom_field_enumerations/destroy.html.erb +0 -14
- data/spec/redmine/app/views/custom_field_enumerations/index.html.erb +0 -47
- data/spec/redmine/app/views/custom_fields/formats/_enumeration.erb +0 -12
- data/spec/redmine/app/views/imports/_fields_mapping.html.erb +0 -90
- data/spec/redmine/app/views/imports/mapping.html.erb +0 -52
- data/spec/redmine/app/views/imports/mapping.js.erb +0 -1
- data/spec/redmine/app/views/imports/new.html.erb +0 -15
- data/spec/redmine/app/views/imports/run.html.erb +0 -20
- data/spec/redmine/app/views/imports/run.js.erb +0 -11
- data/spec/redmine/app/views/imports/settings.html.erb +0 -30
- data/spec/redmine/app/views/imports/show.html.erb +0 -38
- data/spec/redmine/app/views/layouts/_file.html.erb +0 -15
- data/spec/redmine/app/views/mailer/security_notification.html.erb +0 -13
- data/spec/redmine/app/views/mailer/security_notification.text.erb +0 -8
- data/spec/redmine/app/views/mailer/settings_updated.html.erb +0 -14
- data/spec/redmine/app/views/mailer/settings_updated.text.erb +0 -12
- data/spec/redmine/app/views/queries/_query_form.html.erb +0 -62
- data/spec/redmine/app/views/repositories/_changeset.html.erb +0 -40
- data/spec/redmine/app/views/search/index.api.rsb +0 -12
- data/spec/redmine/app/views/settings/_api.html.erb +0 -10
- data/spec/redmine/app/views/settings/_attachments.html.erb +0 -21
- data/spec/redmine/app/views/wiki/_new_modal.html.erb +0 -21
- data/spec/redmine/app/views/wiki/new.html.erb +0 -17
- data/spec/redmine/app/views/wiki/new.js.erb +0 -2
- data/spec/redmine/appveyor.yml +0 -36
- data/spec/redmine/db/migrate/20150725112753_insert_allowed_statuses_for_new_issues.rb +0 -23
- data/spec/redmine/db/migrate/20150730122707_create_imports.rb +0 -13
- data/spec/redmine/db/migrate/20150730122735_create_import_items.rb +0 -10
- data/spec/redmine/db/migrate/20150921204850_change_time_entries_comments_limit_to_1024.rb +0 -9
- data/spec/redmine/db/migrate/20150921210243_change_wiki_contents_comments_limit_to_1024.rb +0 -11
- data/spec/redmine/db/migrate/20151020182334_change_attachments_filesize_limit_to_8.rb +0 -9
- data/spec/redmine/db/migrate/20151020182731_fix_comma_in_user_format_setting_value.rb +0 -13
- data/spec/redmine/db/migrate/20151021184614_change_issue_categories_name_limit_to_60.rb +0 -9
- data/spec/redmine/db/migrate/20151021185456_change_auth_sources_filter_to_text.rb +0 -9
- data/spec/redmine/db/migrate/20151021190616_change_user_preferences_hide_mail_default_to_true.rb +0 -9
- data/spec/redmine/db/migrate/20151024082034_add_tokens_updated_on.rb +0 -10
- data/spec/redmine/db/migrate/20151025072118_create_custom_field_enumerations.rb +0 -10
- data/spec/redmine/db/migrate/20151031095005_add_projects_default_version_id.rb +0 -12
- data/spec/redmine/db/migrate/20160404080304_force_password_reset_during_setup.rb +0 -9
- data/spec/redmine/db/migrate/20160416072926_remove_position_defaults.rb +0 -13
- data/spec/redmine/db/migrate/20160529063352_add_roles_settings.rb +0 -5
- data/spec/redmine/lib/redmine/acts/positioned.rb +0 -118
- data/spec/redmine/lib/redmine/helpers/url.rb +0 -35
- data/spec/redmine/lib/redmine/hook/listener.rb +0 -32
- data/spec/redmine/lib/redmine/hook/view_listener.rb +0 -78
- data/spec/redmine/log/test.log +0 -2
- data/spec/redmine/plugins/dummy_plugin/Gemfile +0 -1
- data/spec/redmine/plugins/dummy_plugin/app/controllers/dummy_autocompletes_controller.rb +0 -4
- data/spec/redmine/plugins/dummy_plugin/app/views/dummy_autocompletes/index.html.erb +0 -3
- data/spec/redmine/plugins/dummy_plugin/config/locales/en.yml +0 -2
- data/spec/redmine/plugins/dummy_plugin/config/routes.rb +0 -1
- data/spec/redmine/plugins/dummy_plugin/init.rb +0 -34
- data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/easy_patch/redmine/controllers/issues_controller_patch.example +0 -30
- data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/easy_patch/redmine/helpers/issues_helper_patch.example +0 -30
- data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/easy_patch/redmine/models/issue_patch.example +0 -30
- data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/hooks.rb +0 -5
- data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/internals.rb +0 -4
- data/spec/redmine/public/images/jstoolbar/bt_precode.png +0 -0
- data/spec/redmine/public/images/reorder.png +0 -0
- data/spec/redmine/public/javascripts/jquery-1.11.1-ui-1.11.0-ujs-3.1.4.js +0 -21
- data/spec/redmine/public/javascripts/redmine_extensions/application.js +0 -13
- data/spec/redmine/public/javascripts/redmine_extensions/easy_togglers.js +0 -58
- data/spec/redmine/public/javascripts/redmine_extensions/jquery.entityarray.js +0 -130
- data/spec/redmine/public/javascripts/redmine_extensions/redmine_extensions.js +0 -642
- data/spec/redmine/public/javascripts/responsive.js +0 -83
- data/spec/redmine/public/stylesheets/responsive.css +0 -799
- data/spec/redmine/test/fixtures/files/import_dates.csv +0 -4
- data/spec/redmine/test/fixtures/files/import_iso8859-1.csv +0 -3
- data/spec/redmine/test/fixtures/files/import_issues.csv +0 -4
- data/spec/redmine/test/fixtures/ldap/slapd.centos6.conf +0 -24
- data/spec/redmine/test/fixtures/ldap/slapd.ubuntu.12.04.conf +0 -23
- data/spec/redmine/test/fixtures/mail_handler/issue_update_with_cc.eml +0 -19
- data/spec/redmine/test/fixtures/mail_handler/ticket_on_project_given_by_to_header.eml +0 -60
- data/spec/redmine/test/fixtures/mail_handler/ticket_with_text_attachment_iso-8859-2.eml +0 -31
- data/spec/redmine/test/functional/custom_field_enumerations_controller_test.rb +0 -115
- data/spec/redmine/test/functional/imports_controller_test.rb +0 -205
- data/spec/redmine/test/functional/sessions_controller_test.rb +0 -138
- data/spec/redmine/test/integration/api_test/search_test.rb +0 -92
- data/spec/redmine/test/integration/routing/imports_test.rb +0 -36
- data/spec/redmine/test/integration/sessions_test.rb +0 -97
- data/spec/redmine/test/ui/custom_fields_test_ui.rb +0 -38
- data/spec/redmine/test/unit/attachment_transaction_test.rb +0 -76
- data/spec/redmine/test/unit/helpers/journals_helper_test.rb +0 -48
- data/spec/redmine/test/unit/helpers/wiki_helper_test.rb +0 -45
- data/spec/redmine/test/unit/issue_import_test.rb +0 -178
- data/spec/redmine/test/unit/lib/redmine/acts/positioned_with_scope_test.rb +0 -53
- data/spec/redmine/test/unit/lib/redmine/acts/positioned_without_scope_test.rb +0 -55
- data/spec/redmine/test/unit/lib/redmine/field_format/enumeration_format_test.rb +0 -91
- data/spec/support/easy_queries_helpers.rb +0 -0
@@ -1,48 +0,0 @@
|
|
1
|
-
# Redmine - project management software
|
2
|
-
# Copyright (C) 2006-2016 Jean-Philippe Lang
|
3
|
-
#
|
4
|
-
# This program is free software; you can redistribute it and/or
|
5
|
-
# modify it under the terms of the GNU General Public License
|
6
|
-
# as published by the Free Software Foundation; either version 2
|
7
|
-
# of the License, or (at your option) any later version.
|
8
|
-
#
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
# GNU General Public License for more details.
|
13
|
-
#
|
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
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
17
|
-
|
18
|
-
require File.expand_path('../../../test_helper', __FILE__)
|
19
|
-
|
20
|
-
class JournalsHelperTest < Redmine::HelperTest
|
21
|
-
include JournalsHelper
|
22
|
-
|
23
|
-
fixtures :projects, :trackers, :issue_statuses, :issues,
|
24
|
-
:enumerations, :issue_categories,
|
25
|
-
:projects_trackers,
|
26
|
-
:users, :roles, :member_roles, :members,
|
27
|
-
:enabled_modules,
|
28
|
-
:custom_fields,
|
29
|
-
:attachments,
|
30
|
-
:versions
|
31
|
-
|
32
|
-
def test_journal_thumbnail_attachments_should_return_thumbnailable_attachments
|
33
|
-
issue = Issue.generate!
|
34
|
-
|
35
|
-
journal = new_record(Journal) do
|
36
|
-
issue.init_journal(User.find(1))
|
37
|
-
issue.attachments << Attachment.new(:file => mock_file_with_options(:original_filename => 'image.png'), :author => User.find(1))
|
38
|
-
issue.attachments << Attachment.new(:file => mock_file_with_options(:original_filename => 'foo'), :author => User.find(1))
|
39
|
-
issue.save
|
40
|
-
end
|
41
|
-
assert_equal 2, journal.details.count
|
42
|
-
|
43
|
-
thumbnails = journal_thumbnail_attachments(journal)
|
44
|
-
assert_equal 1, thumbnails.count
|
45
|
-
assert_kind_of Attachment, thumbnails.first
|
46
|
-
assert_equal 'image.png', thumbnails.first.filename
|
47
|
-
end
|
48
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# Redmine - project management software
|
2
|
-
# Copyright (C) 2006-2016 Jean-Philippe Lang
|
3
|
-
#
|
4
|
-
# This program is free software; you can redistribute it and/or
|
5
|
-
# modify it under the terms of the GNU General Public License
|
6
|
-
# as published by the Free Software Foundation; either version 2
|
7
|
-
# of the License, or (at your option) any later version.
|
8
|
-
#
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
# GNU General Public License for more details.
|
13
|
-
#
|
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
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
17
|
-
|
18
|
-
require File.expand_path('../../../test_helper', __FILE__)
|
19
|
-
|
20
|
-
class WikiHelperTest < Redmine::HelperTest
|
21
|
-
include WikiHelper
|
22
|
-
include Rails.application.routes.url_helpers
|
23
|
-
|
24
|
-
fixtures :projects, :users,
|
25
|
-
:roles, :member_roles, :members,
|
26
|
-
:enabled_modules, :wikis, :wiki_pages
|
27
|
-
|
28
|
-
def test_wiki_page_edit_cancel_path_for_new_page_without_parent_should_be_wiki_index
|
29
|
-
wiki = Wiki.find(1)
|
30
|
-
page = WikiPage.new(:wiki => wiki)
|
31
|
-
assert_equal '/projects/ecookbook/wiki/index', wiki_page_edit_cancel_path(page)
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_wiki_page_edit_cancel_path_for_new_page_with_parent_should_be_parent
|
35
|
-
wiki = Wiki.find(1)
|
36
|
-
page = WikiPage.new(:wiki => wiki, :parent => wiki.find_page('Another_page'))
|
37
|
-
assert_equal '/projects/ecookbook/wiki/Another_page', wiki_page_edit_cancel_path(page)
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_wiki_page_edit_cancel_path_for_existing_page_should_be_the_page
|
41
|
-
wiki = Wiki.find(1)
|
42
|
-
page = wiki.find_page('Child_1')
|
43
|
-
assert_equal '/projects/ecookbook/wiki/Child_1', wiki_page_edit_cancel_path(page)
|
44
|
-
end
|
45
|
-
end
|
@@ -1,178 +0,0 @@
|
|
1
|
-
# Redmine - project management software
|
2
|
-
# Copyright (C) 2006-2016 Jean-Philippe Lang
|
3
|
-
#
|
4
|
-
# This program is free software; you can redistribute it and/or
|
5
|
-
# modify it under the terms of the GNU General Public License
|
6
|
-
# as published by the Free Software Foundation; either version 2
|
7
|
-
# of the License, or (at your option) any later version.
|
8
|
-
#
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
# GNU General Public License for more details.
|
13
|
-
#
|
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
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
17
|
-
|
18
|
-
require File.expand_path('../../test_helper', __FILE__)
|
19
|
-
|
20
|
-
class IssueImportTest < ActiveSupport::TestCase
|
21
|
-
fixtures :projects, :enabled_modules,
|
22
|
-
:users, :email_addresses,
|
23
|
-
:roles, :members, :member_roles,
|
24
|
-
:issues, :issue_statuses,
|
25
|
-
:trackers, :projects_trackers,
|
26
|
-
:versions,
|
27
|
-
:issue_categories,
|
28
|
-
:enumerations,
|
29
|
-
:workflows,
|
30
|
-
:custom_fields,
|
31
|
-
:custom_values,
|
32
|
-
:custom_fields_projects,
|
33
|
-
:custom_fields_trackers
|
34
|
-
|
35
|
-
include Redmine::I18n
|
36
|
-
|
37
|
-
def setup
|
38
|
-
set_language_if_valid 'en'
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_create_versions_should_create_missing_versions
|
42
|
-
import = generate_import_with_mapping
|
43
|
-
import.mapping.merge!('fixed_version' => '9', 'create_versions' => '1')
|
44
|
-
import.save!
|
45
|
-
|
46
|
-
version = new_record(Version) do
|
47
|
-
assert_difference 'Issue.count', 3 do
|
48
|
-
import.run
|
49
|
-
end
|
50
|
-
end
|
51
|
-
assert_equal '2.1', version.name
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_create_categories_should_create_missing_categories
|
55
|
-
import = generate_import_with_mapping
|
56
|
-
import.mapping.merge!('category' => '10', 'create_categories' => '1')
|
57
|
-
import.save!
|
58
|
-
|
59
|
-
category = new_record(IssueCategory) do
|
60
|
-
assert_difference 'Issue.count', 3 do
|
61
|
-
import.run
|
62
|
-
end
|
63
|
-
end
|
64
|
-
assert_equal 'New category', category.name
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_mapping_with_fixed_tracker
|
68
|
-
import = generate_import_with_mapping
|
69
|
-
import.mapping.merge!('tracker' => 'value:2')
|
70
|
-
import.save!
|
71
|
-
|
72
|
-
issues = new_records(Issue, 3) { import.run }
|
73
|
-
assert_equal [2], issues.map(&:tracker_id).uniq
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_mapping_with_mapped_tracker
|
77
|
-
import = generate_import_with_mapping
|
78
|
-
import.mapping.merge!('tracker' => '13')
|
79
|
-
import.save!
|
80
|
-
|
81
|
-
issues = new_records(Issue, 3) { import.run }
|
82
|
-
assert_equal [1, 2, 1], issues.map(&:tracker_id)
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_should_not_import_with_default_tracker_when_tracker_is_invalid
|
86
|
-
Tracker.find_by_name('Feature request').update!(:name => 'Feature')
|
87
|
-
|
88
|
-
import = generate_import_with_mapping
|
89
|
-
import.mapping.merge!('tracker' => '13')
|
90
|
-
import.save!
|
91
|
-
import.run
|
92
|
-
|
93
|
-
assert_equal 1, import.unsaved_items.count
|
94
|
-
item = import.unsaved_items.first
|
95
|
-
assert_include "Tracker cannot be blank", item.message
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_status_should_be_set
|
99
|
-
import = generate_import_with_mapping
|
100
|
-
import.mapping.merge!('status' => '14')
|
101
|
-
import.save!
|
102
|
-
|
103
|
-
issues = new_records(Issue, 3) { import.run }
|
104
|
-
assert_equal ['New', 'New', 'Assigned'], issues.map(&:status).map(&:name)
|
105
|
-
end
|
106
|
-
|
107
|
-
def test_parent_should_be_set
|
108
|
-
import = generate_import_with_mapping
|
109
|
-
import.mapping.merge!('parent_issue_id' => '5')
|
110
|
-
import.save!
|
111
|
-
|
112
|
-
issues = new_records(Issue, 3) { import.run }
|
113
|
-
assert_nil issues[0].parent
|
114
|
-
assert_equal issues[0].id, issues[1].parent_id
|
115
|
-
assert_equal 2, issues[2].parent_id
|
116
|
-
end
|
117
|
-
|
118
|
-
def test_assignee_should_be_set
|
119
|
-
import = generate_import_with_mapping
|
120
|
-
import.mapping.merge!('assigned_to' => '11')
|
121
|
-
import.save!
|
122
|
-
|
123
|
-
issues = new_records(Issue, 3) { import.run }
|
124
|
-
assert_equal [User.find(3), nil, nil], issues.map(&:assigned_to)
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_user_custom_field_should_be_set
|
128
|
-
field = IssueCustomField.generate!(:field_format => 'user', :is_for_all => true, :trackers => Tracker.all)
|
129
|
-
import = generate_import_with_mapping
|
130
|
-
import.mapping.merge!("cf_#{field.id}" => '11')
|
131
|
-
import.save!
|
132
|
-
|
133
|
-
issues = new_records(Issue, 3) { import.run }
|
134
|
-
assert_equal '3', issues.first.custom_field_value(field)
|
135
|
-
end
|
136
|
-
|
137
|
-
def test_is_private_should_be_set_based_on_user_locale
|
138
|
-
import = generate_import_with_mapping
|
139
|
-
import.mapping.merge!('is_private' => '6')
|
140
|
-
import.save!
|
141
|
-
|
142
|
-
issues = new_records(Issue, 3) { import.run }
|
143
|
-
assert_equal [false, true, false], issues.map(&:is_private)
|
144
|
-
end
|
145
|
-
|
146
|
-
def test_dates_should_be_parsed_using_date_format_setting
|
147
|
-
field = IssueCustomField.generate!(:field_format => 'date', :is_for_all => true, :trackers => Tracker.all)
|
148
|
-
import = generate_import_with_mapping('import_dates.csv')
|
149
|
-
import.settings.merge!('date_format' => Import::DATE_FORMATS[1])
|
150
|
-
import.mapping.merge!('tracker' => 'value:1', 'subject' => '0', 'start_date' => '1', 'due_date' => '2', "cf_#{field.id}" => '3')
|
151
|
-
import.save!
|
152
|
-
|
153
|
-
issue = new_record(Issue) { import.run } # only 1 valid issue
|
154
|
-
assert_equal "Valid dates", issue.subject
|
155
|
-
assert_equal Date.parse('2015-07-10'), issue.start_date
|
156
|
-
assert_equal Date.parse('2015-08-12'), issue.due_date
|
157
|
-
assert_equal '2015-07-14', issue.custom_field_value(field)
|
158
|
-
end
|
159
|
-
|
160
|
-
def test_date_format_should_default_to_user_language
|
161
|
-
user = User.generate!(:language => 'fr')
|
162
|
-
import = Import.new
|
163
|
-
import.user = user
|
164
|
-
assert_nil import.settings['date_format']
|
165
|
-
|
166
|
-
import.set_default_settings
|
167
|
-
assert_equal '%d/%m/%Y', import.settings['date_format']
|
168
|
-
end
|
169
|
-
|
170
|
-
def test_run_should_remove_the_file
|
171
|
-
import = generate_import_with_mapping
|
172
|
-
file_path = import.filepath
|
173
|
-
assert File.exists?(file_path)
|
174
|
-
|
175
|
-
import.run
|
176
|
-
assert !File.exists?(file_path)
|
177
|
-
end
|
178
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# Redmine - project management software
|
2
|
-
# Copyright (C) 2006-2016 Jean-Philippe Lang
|
3
|
-
#
|
4
|
-
# This program is free software; you can redistribute it and/or
|
5
|
-
# modify it under the terms of the GNU General Public License
|
6
|
-
# as published by the Free Software Foundation; either version 2
|
7
|
-
# of the License, or (at your option) any later version.
|
8
|
-
#
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
# GNU General Public License for more details.
|
13
|
-
#
|
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
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
17
|
-
|
18
|
-
require File.expand_path('../../../../../test_helper', __FILE__)
|
19
|
-
|
20
|
-
class Redmine::Acts::PositionedWithScopeTest < ActiveSupport::TestCase
|
21
|
-
fixtures :projects, :boards
|
22
|
-
|
23
|
-
def test_create_should_default_to_last_position
|
24
|
-
b = Board.generate!(:project_id => 1)
|
25
|
-
assert_equal 3, b.reload.position
|
26
|
-
|
27
|
-
b = Board.generate!(:project_id => 3)
|
28
|
-
assert_equal 1, b.reload.position
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_create_should_insert_at_given_position
|
32
|
-
b = Board.generate!(:project_id => 1, :position => 2)
|
33
|
-
|
34
|
-
assert_equal 2, b.reload.position
|
35
|
-
assert_equal [1, 3, 1, 2], Board.order(:id).pluck(:position)
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_destroy_should_remove_position
|
39
|
-
b = Board.generate!(:project_id => 1, :position => 2)
|
40
|
-
b.destroy
|
41
|
-
|
42
|
-
assert_equal [1, 2, 1], Board.order(:id).pluck(:position)
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_update_should_update_positions
|
46
|
-
b = Board.generate!(:project_id => 1)
|
47
|
-
assert_equal 3, b.position
|
48
|
-
|
49
|
-
b.position = 2
|
50
|
-
b.save!
|
51
|
-
assert_equal [1, 3, 1, 2], Board.order(:id).pluck(:position)
|
52
|
-
end
|
53
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# Redmine - project management software
|
2
|
-
# Copyright (C) 2006-2016 Jean-Philippe Lang
|
3
|
-
#
|
4
|
-
# This program is free software; you can redistribute it and/or
|
5
|
-
# modify it under the terms of the GNU General Public License
|
6
|
-
# as published by the Free Software Foundation; either version 2
|
7
|
-
# of the License, or (at your option) any later version.
|
8
|
-
#
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
# GNU General Public License for more details.
|
13
|
-
#
|
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
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
17
|
-
|
18
|
-
require File.expand_path('../../../../../test_helper', __FILE__)
|
19
|
-
|
20
|
-
class Redmine::Acts::PositionedWithoutScopeTest < ActiveSupport::TestCase
|
21
|
-
fixtures :trackers, :issue_statuses
|
22
|
-
|
23
|
-
def test_create_should_default_to_last_position
|
24
|
-
t = Tracker.generate
|
25
|
-
t.save!
|
26
|
-
|
27
|
-
assert_equal 4, t.reload.position
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_create_should_insert_at_given_position
|
31
|
-
t = Tracker.generate
|
32
|
-
t.position = 2
|
33
|
-
t.save!
|
34
|
-
|
35
|
-
assert_equal 2, t.reload.position
|
36
|
-
assert_equal [1, 3, 4, 2], Tracker.order(:id).pluck(:position)
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_destroy_should_remove_position
|
40
|
-
t = Tracker.generate!
|
41
|
-
Tracker.generate!
|
42
|
-
t.destroy
|
43
|
-
|
44
|
-
assert_equal [1, 2, 3, 4], Tracker.order(:id).pluck(:position)
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_update_should_update_positions
|
48
|
-
t = Tracker.generate!
|
49
|
-
assert_equal 4, t.position
|
50
|
-
|
51
|
-
t.position = 2
|
52
|
-
t.save!
|
53
|
-
assert_equal [1, 3, 4, 2], Tracker.order(:id).pluck(:position)
|
54
|
-
end
|
55
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
# Redmine - project management software
|
2
|
-
# Copyright (C) 2006-2016 Jean-Philippe Lang
|
3
|
-
#
|
4
|
-
# This program is free software; you can redistribute it and/or
|
5
|
-
# modify it under the terms of the GNU General Public License
|
6
|
-
# as published by the Free Software Foundation; either version 2
|
7
|
-
# of the License, or (at your option) any later version.
|
8
|
-
#
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
# GNU General Public License for more details.
|
13
|
-
#
|
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
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
17
|
-
|
18
|
-
require File.expand_path('../../../../../test_helper', __FILE__)
|
19
|
-
require 'redmine/field_format'
|
20
|
-
|
21
|
-
class Redmine::EnumerationFieldFormatTest < ActionView::TestCase
|
22
|
-
include ApplicationHelper
|
23
|
-
|
24
|
-
def setup
|
25
|
-
set_language_if_valid 'en'
|
26
|
-
@field = IssueCustomField.create!(:name => 'List', :field_format => 'enumeration', :is_required => false)
|
27
|
-
@foo = CustomFieldEnumeration.new(:name => 'Foo')
|
28
|
-
@bar = CustomFieldEnumeration.new(:name => 'Bar')
|
29
|
-
@field.enumerations << @foo
|
30
|
-
@field.enumerations << @bar
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_edit_tag_should_contain_possible_values
|
34
|
-
value = CustomFieldValue.new(:custom_field => @field, :customized => Issue.new)
|
35
|
-
|
36
|
-
tag = @field.format.edit_tag(self, 'id', 'name', value)
|
37
|
-
assert_select_in tag, 'select' do
|
38
|
-
assert_select 'option', 3
|
39
|
-
assert_select 'option[value=""]'
|
40
|
-
assert_select 'option[value=?]', @foo.id.to_s, :text => 'Foo'
|
41
|
-
assert_select 'option[value=?]', @bar.id.to_s, :text => 'Bar'
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_edit_tag_should_select_current_value
|
46
|
-
value = CustomFieldValue.new(:custom_field => @field, :customized => Issue.new, :value => @bar.id.to_s)
|
47
|
-
|
48
|
-
tag = @field.format.edit_tag(self, 'id', 'name', value)
|
49
|
-
assert_select_in tag, 'select' do
|
50
|
-
assert_select 'option[selected=selected]', 1
|
51
|
-
assert_select 'option[value=?][selected=selected]', @bar.id.to_s, :text => 'Bar'
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_edit_tag_with_multiple_should_select_current_values
|
56
|
-
@field.multiple = true
|
57
|
-
@field.save!
|
58
|
-
value = CustomFieldValue.new(:custom_field => @field, :customized => Issue.new, :value => [@foo.id.to_s, @bar.id.to_s])
|
59
|
-
|
60
|
-
tag = @field.format.edit_tag(self, 'id', 'name', value)
|
61
|
-
assert_select_in tag, 'select[multiple=multiple]' do
|
62
|
-
assert_select 'option[selected=selected]', 2
|
63
|
-
assert_select 'option[value=?][selected=selected]', @foo.id.to_s, :text => 'Foo'
|
64
|
-
assert_select 'option[value=?][selected=selected]', @bar.id.to_s, :text => 'Bar'
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_edit_tag_with_check_box_style_should_contain_possible_values
|
69
|
-
@field.edit_tag_style = 'check_box'
|
70
|
-
@field.save!
|
71
|
-
value = CustomFieldValue.new(:custom_field => @field, :customized => Issue.new)
|
72
|
-
|
73
|
-
tag = @field.format.edit_tag(self, 'id', 'name', value)
|
74
|
-
assert_select_in tag, 'span' do
|
75
|
-
assert_select 'input[type=radio]', 3
|
76
|
-
assert_select 'label', :text => '(none)' do
|
77
|
-
assert_select 'input[value=""]'
|
78
|
-
end
|
79
|
-
assert_select 'label', :text => 'Foo' do
|
80
|
-
assert_select 'input[value=?]', @foo.id.to_s
|
81
|
-
end
|
82
|
-
assert_select 'label', :text => 'Bar' do
|
83
|
-
assert_select 'input[value=?]', @bar.id.to_s
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_value_from_keyword_should_return_enumeration_id
|
89
|
-
assert_equal @foo.id, @field.value_from_keyword('foo', nil)
|
90
|
-
end
|
91
|
-
end
|