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.

repository_subversion_test.rb 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 RepositorySubversionTest < Test::Unit::TestCase
  19. fixtures :projects
  20. # No '..' in the repository path for svn
  21. REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository'
  22. def setup
  23. @project = Project.find(1)
  24. assert @repository = Repository::Subversion.create(:project => @project, :url => "file:///#{REPOSITORY_PATH}")
  25. end
  26. if File.directory?(REPOSITORY_PATH)
  27. def test_fetch_changesets_from_scratch
  28. @repository.fetch_changesets
  29. @repository.reload
  30. assert_equal 8, @repository.changesets.count
  31. assert_equal 16, @repository.changes.count
  32. assert_equal 'Initial import.', @repository.changesets.find_by_revision(1).comments
  33. end
  34. def test_fetch_changesets_incremental
  35. @repository.fetch_changesets
  36. # Remove changesets with revision > 5
  37. @repository.changesets.find(:all, :conditions => 'revision > 5').each(&:destroy)
  38. @repository.reload
  39. assert_equal 5, @repository.changesets.count
  40. @repository.fetch_changesets
  41. assert_equal 8, @repository.changesets.count
  42. end
  43. else
  44. puts "Subversion test repository NOT FOUND. Skipping tests !!!"
  45. def test_fake; assert true end
  46. end
  47. end