Mercurial > hg > soundsoftware-site
comparison test/unit/repository_git_test.rb @ 119:8661b858af72
* Update to Redmine trunk rev 4705
author | Chris Cannam |
---|---|
date | Thu, 13 Jan 2011 14:12:06 +0000 |
parents | 94944d00e43c |
children | 051f544170fe |
comparison
equal
deleted
inserted
replaced
39:150ceac17a8d | 119:8661b858af72 |
---|---|
13 # | 13 # |
14 # You should have received a copy of the GNU General Public License | 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 | 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. | 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | 17 |
18 require File.dirname(__FILE__) + '/../test_helper' | 18 require File.expand_path('../../test_helper', __FILE__) |
19 | 19 |
20 class RepositoryGitTest < ActiveSupport::TestCase | 20 class RepositoryGitTest < ActiveSupport::TestCase |
21 fixtures :projects | 21 fixtures :projects, :repositories, :enabled_modules, :users, :roles |
22 | 22 |
23 # No '..' in the repository path | 23 # No '..' in the repository path |
24 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository' | 24 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/git_repository' |
25 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? | 25 REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? |
26 | 26 |
60 assert_equal 12, @repository.changesets.count | 60 assert_equal 12, @repository.changesets.count |
61 | 61 |
62 @repository.fetch_changesets | 62 @repository.fetch_changesets |
63 assert_equal 15, @repository.changesets.count | 63 assert_equal 15, @repository.changesets.count |
64 end | 64 end |
65 | |
66 def test_find_changeset_by_name | |
67 @repository.fetch_changesets | |
68 @repository.reload | |
69 ['7234cb2750b63f47bff735edc50a1c0a433c2518', '7234cb2750b'].each do |r| | |
70 assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518', | |
71 @repository.find_changeset_by_name(r).revision | |
72 end | |
73 end | |
74 | |
75 def test_find_changeset_by_empty_name | |
76 @repository.fetch_changesets | |
77 @repository.reload | |
78 ['', ' ', nil].each do |r| | |
79 assert_nil @repository.find_changeset_by_name(r) | |
80 end | |
81 end | |
82 | |
83 def test_identifier | |
84 @repository.fetch_changesets | |
85 @repository.reload | |
86 c = @repository.changesets.find_by_revision('7234cb2750b63f47bff735edc50a1c0a433c2518') | |
87 assert_equal c.scmid, c.identifier | |
88 end | |
89 | |
90 def test_format_identifier | |
91 @repository.fetch_changesets | |
92 @repository.reload | |
93 c = @repository.changesets.find_by_revision('7234cb2750b63f47bff735edc50a1c0a433c2518') | |
94 assert_equal '7234cb27', c.format_identifier | |
95 end | |
96 | |
97 def test_activities | |
98 c = Changeset.new(:repository => @repository, | |
99 :committed_on => Time.now, | |
100 :revision => 'abc7234cb2750b63f47bff735edc50a1c0a433c2', | |
101 :scmid => 'abc7234cb2750b63f47bff735edc50a1c0a433c2', | |
102 :comments => 'test') | |
103 assert c.event_title.include?('abc7234c:') | |
104 assert_equal 'abc7234cb2750b63f47bff735edc50a1c0a433c2', c.event_url[:rev] | |
105 end | |
65 else | 106 else |
66 puts "Git test repository NOT FOUND. Skipping unit tests !!!" | 107 puts "Git test repository NOT FOUND. Skipping unit tests !!!" |
67 def test_fake; assert true end | 108 def test_fake; assert true end |
68 end | 109 end |
69 end | 110 end |