@@ -18,25 +18,26 | |||||
18 | require File.expand_path('../../test_helper', __FILE__) |
|
18 | require File.expand_path('../../test_helper', __FILE__) | |
19 |
|
19 | |||
20 | class RepositoryGitTest < ActiveSupport::TestCase |
|
20 | class RepositoryGitTest < ActiveSupport::TestCase | |
21 |
fixtures :projects, :repositories, :enabled_modules, :users, :roles |
|
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 | |||
27 | def setup |
|
27 | def setup | |
28 |
@project = Project.find( |
|
28 | @project = Project.find(3) | |
29 |
|
|
29 | @repository = Repository::Git.create(:project => @project, :url => REPOSITORY_PATH) | |
|
30 | assert @repository | |||
30 | end |
|
31 | end | |
31 |
|
32 | |||
32 | if File.directory?(REPOSITORY_PATH) |
|
33 | if File.directory?(REPOSITORY_PATH) | |
33 | def test_fetch_changesets_from_scratch |
|
34 | def test_fetch_changesets_from_scratch | |
34 | @repository.fetch_changesets |
|
35 | @repository.fetch_changesets | |
35 | @repository.reload |
|
36 | @repository.reload | |
36 |
|
37 | |||
37 | assert_equal 15, @repository.changesets.count |
|
38 | assert_equal 15, @repository.changesets.count | |
38 | assert_equal 24, @repository.changes.count |
|
39 | assert_equal 24, @repository.changes.count | |
39 |
|
40 | |||
40 | commit = @repository.changesets.find(:first, :order => 'committed_on ASC') |
|
41 | commit = @repository.changesets.find(:first, :order => 'committed_on ASC') | |
41 | assert_equal "Initial import.\nThe repository contains 3 files.", commit.comments |
|
42 | assert_equal "Initial import.\nThe repository contains 3 files.", commit.comments | |
42 | assert_equal "jsmith <jsmith@foo.bar>", commit.committer |
|
43 | assert_equal "jsmith <jsmith@foo.bar>", commit.committer |
General Comments 0
You need to be logged in to leave comments.
Login now