diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-01-02 09:45:05 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-01-02 09:45:05 +0000 |
commit | 2e1bcb2abff6f78f028064299125480cbf3c2c2a (patch) | |
tree | 0e277b38e1f527d703466a2857c56953f12cf7ff /test/unit/repository_subversion_test.rb | |
parent | 2ae2d3ef834c4d17b1c7a4e09f299b537f91d3cc (diff) | |
download | redmine-2e1bcb2abff6f78f028064299125480cbf3c2c2a.tar.gz redmine-2e1bcb2abff6f78f028064299125480cbf3c2c2a.zip |
Changing revision label and identifier at SCM adapter level (#3724, #6092)
Contributed by Yuya Nishihara.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4613 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/repository_subversion_test.rb')
-rw-r--r-- | test/unit/repository_subversion_test.rb | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/test/unit/repository_subversion_test.rb b/test/unit/repository_subversion_test.rb index 903cdd049..5034c30cf 100644 --- a/test/unit/repository_subversion_test.rb +++ b/test/unit/repository_subversion_test.rb @@ -18,7 +18,7 @@ require File.expand_path('../../test_helper', __FILE__) class RepositorySubversionTest < ActiveSupport::TestCase - fixtures :projects, :repositories + fixtures :projects, :repositories, :enabled_modules, :users, :roles def setup @project = Project.find(1) @@ -88,6 +88,57 @@ class RepositorySubversionTest < ActiveSupport::TestCase assert_equal 1, entries.size, 'Expect a single entry' assert_equal 'README.txt', entries.first.name end + + def test_identifier + @repository.fetch_changesets + @repository.reload + c = @repository.changesets.find_by_revision('1') + assert_equal c.revision, c.identifier + end + + def test_identifier_nine_digit + c = Changeset.new(:repository => @repository, :committed_on => Time.now, + :revision => '123456789', :comments => 'test') + assert_equal c.identifier, c.revision + end + + def test_format_identifier + @repository.fetch_changesets + @repository.reload + c = @repository.changesets.find_by_revision('1') + assert_equal c.format_identifier, c.revision + end + + def test_format_identifier_nine_digit + c = Changeset.new(:repository => @repository, :committed_on => Time.now, + :revision => '123456789', :comments => 'test') + assert_equal c.format_identifier, c.revision + end + + def test_activities + @repository.fetch_changesets + @repository.reload + f = Redmine::Activity::Fetcher.new(User.anonymous, :project => Project.find(1)) + f.scope = ['changesets'] + events = f.events + assert_kind_of Array, events + eve = events[-9] + assert eve.event_title.include?('1:') + assert_equal eve.event_url[:rev], '1' + end + + def test_activities_nine_digit + c = Changeset.new(:repository => @repository, :committed_on => Time.now, + :revision => '123456789', :comments => 'test') + assert( c.save ) + f = Redmine::Activity::Fetcher.new(User.anonymous, :project => Project.find(1)) + f.scope = ['changesets'] + events = f.events + assert_kind_of Array, events + eve = events[-11] + assert eve.event_title.include?('123456789:') + assert_equal eve.event_url[:rev], '123456789' + end else puts "Subversion test repository NOT FOUND. Skipping unit tests !!!" def test_fake; assert true end |