You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

changeset_test.rb 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # redMine - project management software
  2. # Copyright (C) 2006-2007 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. require File.dirname(__FILE__) + '/../test_helper'
  18. class ChangesetTest < Test::Unit::TestCase
  19. fixtures :projects, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :users, :members, :trackers
  20. def setup
  21. end
  22. def test_ref_keywords_any
  23. Setting.commit_fix_status_id = IssueStatus.find(:first, :conditions => ["is_closed = ?", true]).id
  24. Setting.commit_fix_done_ratio = '90'
  25. Setting.commit_ref_keywords = '*'
  26. Setting.commit_fix_keywords = 'fixes , closes'
  27. c = Changeset.new(:repository => Project.find(1).repository,
  28. :committed_on => Time.now,
  29. :comments => 'New commit (#2). Fixes #1')
  30. c.scan_comment_for_issue_ids
  31. assert_equal [1, 2], c.issue_ids.sort
  32. fixed = Issue.find(1)
  33. assert fixed.closed?
  34. assert_equal 90, fixed.done_ratio
  35. end
  36. def test_previous
  37. changeset = Changeset.find_by_revision(3)
  38. assert_equal Changeset.find_by_revision(2), changeset.previous
  39. end
  40. def test_previous_nil
  41. changeset = Changeset.find_by_revision(1)
  42. assert_nil changeset.previous
  43. end
  44. def test_next
  45. changeset = Changeset.find_by_revision(2)
  46. assert_equal Changeset.find_by_revision(3), changeset.next
  47. end
  48. def test_next_nil
  49. changeset = Changeset.find_by_revision(4)
  50. assert_nil changeset.next
  51. end
  52. end