Actualizar plugin Checklists a 3.1.18 light
This commit is contained in:
parent
a26f5567af
commit
24560c8598
55 changed files with 992 additions and 307 deletions
|
@ -3,7 +3,7 @@
|
|||
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
|
||||
# issue checklists management plugin for Redmine
|
||||
#
|
||||
# Copyright (C) 2011-2017 RedmineUP
|
||||
# Copyright (C) 2011-2020 RedmineUP
|
||||
# http://www.redmineup.com/
|
||||
#
|
||||
# redmine_checklists is free software: you can redistribute it and/or modify
|
||||
|
@ -46,8 +46,7 @@ class ChecklistTest < ActiveSupport::TestCase
|
|||
:journal_details,
|
||||
:queries
|
||||
|
||||
RedmineChecklists::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_checklists).directory + '/test/fixtures/',
|
||||
[:checklists])
|
||||
RedmineChecklists::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_checklists).directory + '/test/fixtures/', [:checklists])
|
||||
def setup
|
||||
RedmineChecklists::TestCase.prepare
|
||||
Setting.default_language = 'en'
|
||||
|
@ -56,11 +55,8 @@ class ChecklistTest < ActiveSupport::TestCase
|
|||
:status_id => 1, :priority => IssuePriority.first,
|
||||
:subject => 'Invoice Issue 1')
|
||||
@checklist_1 = Checklist.create(:subject => 'TEST1', :position => 1, :issue => @issue_1)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
test "should save checklist" do
|
||||
assert @checklist_1.save, "Checklist save error"
|
||||
end
|
||||
|
@ -90,4 +86,53 @@ class ChecklistTest < ActiveSupport::TestCase
|
|||
assert_equal "[x] #{@checklist_1.subject}", @checklist_1.info, "Helper info broken"
|
||||
end
|
||||
|
||||
def test_should_correct_recalculate_rate
|
||||
issues = [
|
||||
[Issue.create(project_id: 1, tracker_id: 1, author_id: 1, status_id: 1, priority: IssuePriority.first, subject: "TI #1", done_ratio: 0,
|
||||
checklists_attributes: {
|
||||
'0' => { subject: 'item 1', is_done: false },
|
||||
'1' => { subject: 'item 2', is_done: false },
|
||||
'2' => { subject: 'item 3', is_done: true },
|
||||
}),
|
||||
30],
|
||||
[Issue.create(project_id: 1, tracker_id: 1, author_id: 1, status_id: 1, priority: IssuePriority.first, subject: "TI #2", done_ratio: 0,
|
||||
checklists_attributes: {
|
||||
'0' => { subject: 'item 1', is_done: false },
|
||||
'1' => { subject: 'item 2', is_done: true },
|
||||
'2' => { subject: 'item 3', is_done: true },
|
||||
}),
|
||||
60],
|
||||
[Issue.create(project_id: 1, tracker_id: 1, author_id: 1, status_id: 1, priority: IssuePriority.first, subject: "TI #3", done_ratio: 0,
|
||||
checklists_attributes: {
|
||||
'0' => { subject: 'item 1', is_done: true },
|
||||
'1' => { subject: 'item 2', is_done: true },
|
||||
'2' => { subject: 'item 3', is_done: true },
|
||||
}),
|
||||
100],
|
||||
[Issue.create(project_id: 1, tracker_id: 1, author_id: 1, status_id: 1, priority: IssuePriority.first, subject: "TI #4", done_ratio: 0,
|
||||
checklists_attributes: {
|
||||
'0' => { subject: 'item 1', is_done: false },
|
||||
'1' => { subject: 'item 2', is_done: false },
|
||||
'2' => { subject: 'section 1', is_done: true, is_section: true },
|
||||
'3' => { subject: 'item 3', is_done: true },
|
||||
}),
|
||||
30],
|
||||
[Issue.create(project_id: 1, tracker_id: 1, author_id: 1, status_id: 1, priority: IssuePriority.first, subject: "TI #5", done_ratio: 0,
|
||||
checklists_attributes: {
|
||||
'0' => { subject: 'section 1', is_done: true, is_section: true }
|
||||
}),
|
||||
0]
|
||||
]
|
||||
|
||||
with_checklists_settings('issue_done_ratio' => '1') do
|
||||
issues.each do |issue, after_ratio|
|
||||
assert_equal 0, issue.done_ratio
|
||||
Checklist.recalc_issue_done_ratio(issue.id)
|
||||
issue.reload
|
||||
assert_equal after_ratio, issue.done_ratio
|
||||
end
|
||||
end
|
||||
ensure
|
||||
issues.each { |issue, ratio| issue.destroy }
|
||||
end
|
||||
end
|
||||
|
|
85
plugins/redmine_checklists/test/unit/issue_test.rb
Normal file
85
plugins/redmine_checklists/test/unit/issue_test.rb
Normal file
|
@ -0,0 +1,85 @@
|
|||
# encoding: utf-8
|
||||
#
|
||||
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
|
||||
# issue checklists management plugin for Redmine
|
||||
#
|
||||
# Copyright (C) 2011-2020 RedmineUP
|
||||
# http://www.redmineup.com/
|
||||
#
|
||||
# redmine_checklists 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# redmine_checklists 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 redmine_checklists. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
require File.expand_path('../../test_helper', __FILE__)
|
||||
include RedmineChecklists::TestHelper
|
||||
|
||||
class IssueTest < ActiveSupport::TestCase
|
||||
fixtures :projects,
|
||||
:users,
|
||||
:roles,
|
||||
:members,
|
||||
:member_roles,
|
||||
:issues,
|
||||
:issue_statuses,
|
||||
:versions,
|
||||
:trackers,
|
||||
:projects_trackers,
|
||||
:issue_categories,
|
||||
:enabled_modules,
|
||||
:enumerations,
|
||||
:attachments,
|
||||
:workflows,
|
||||
:custom_fields,
|
||||
:custom_values,
|
||||
:custom_fields_projects,
|
||||
:custom_fields_trackers,
|
||||
:time_entries,
|
||||
:journals,
|
||||
:journal_details,
|
||||
:queries
|
||||
|
||||
RedmineChecklists::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_checklists).directory + '/test/fixtures/', [:checklists])
|
||||
def setup
|
||||
RedmineChecklists::TestCase.prepare
|
||||
Setting.default_language = 'en'
|
||||
@project = Project.find(1)
|
||||
@issue = Issue.create(:project => @project, :tracker_id => 1, :author_id => 1,
|
||||
:status_id => 1, :priority => IssuePriority.first,
|
||||
:subject => 'TestIssue')
|
||||
@checklist_1 = Checklist.create(:subject => 'TEST1', :position => 1, :issue => @issue)
|
||||
@checklist_2 = Checklist.create(:subject => 'TEST2', :position => 2, :issue => @issue, :is_done => true)
|
||||
@issue.reload
|
||||
end
|
||||
|
||||
def test_issue_shouldnt_close_when_it_has_unfinished_checklists
|
||||
with_checklists_settings('block_issue_closing' => '1') do
|
||||
@issue.status_id = 5
|
||||
assert !@issue.valid?
|
||||
end
|
||||
end
|
||||
|
||||
def test_validation_should_be_ignored_if_setting_disabled
|
||||
with_checklists_settings('block_issue_closing' => '0') do
|
||||
@issue.status_id = 5
|
||||
assert @issue.valid?
|
||||
end
|
||||
end
|
||||
|
||||
def test_issue_should_close_when_all_checklists_finished
|
||||
with_checklists_settings('block_issue_closing' => '1') do
|
||||
@checklist_1.update_attributes(:is_done => true)
|
||||
assert @issue.valid?
|
||||
end
|
||||
ensure
|
||||
@checklist_1.update_attributes(:is_done => false)
|
||||
end
|
||||
end
|
|
@ -3,7 +3,7 @@
|
|||
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
|
||||
# issue checklists management plugin for Redmine
|
||||
#
|
||||
# Copyright (C) 2011-2017 RedmineUP
|
||||
# Copyright (C) 2011-2020 RedmineUP
|
||||
# http://www.redmineup.com/
|
||||
#
|
||||
# redmine_checklists is free software: you can redistribute it and/or modify
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue