##// END OF EJS Templates
scm: darcs: change project id of unit app test from 1 to 3....
Toshi MARUYAMA -
r4858:984283dde99a
parent child
Show More
@@ -19,25 +19,26 require File.expand_path('../../test_helper', __FILE__)
19
19
20 class RepositoryDarcsTest < ActiveSupport::TestCase
20 class RepositoryDarcsTest < ActiveSupport::TestCase
21 fixtures :projects
21 fixtures :projects
22
22
23 # No '..' in the repository path
23 # No '..' in the repository path
24 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/darcs_repository'
24 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/darcs_repository'
25
25
26 def setup
26 def setup
27 @project = Project.find(1)
27 @project = Project.find(3)
28 assert @repository = Repository::Darcs.create(:project => @project, :url => REPOSITORY_PATH)
28 @repository = Repository::Darcs.create(:project => @project, :url => REPOSITORY_PATH)
29 assert @repository
29 end
30 end
30
31
31 if File.directory?(REPOSITORY_PATH)
32 if File.directory?(REPOSITORY_PATH)
32 def test_fetch_changesets_from_scratch
33 def test_fetch_changesets_from_scratch
33 @repository.fetch_changesets
34 @repository.fetch_changesets
34 @repository.reload
35 @repository.reload
35
36
36 assert_equal 6, @repository.changesets.count
37 assert_equal 6, @repository.changesets.count
37 assert_equal 13, @repository.changes.count
38 assert_equal 13, @repository.changes.count
38 assert_equal "Initial commit.", @repository.changesets.find_by_revision('1').comments
39 assert_equal "Initial commit.", @repository.changesets.find_by_revision('1').comments
39 end
40 end
40
41
41 def test_fetch_changesets_incremental
42 def test_fetch_changesets_incremental
42 @repository.fetch_changesets
43 @repository.fetch_changesets
43 # Remove changesets with revision > 3
44 # Remove changesets with revision > 3
@@ -48,8 +49,10 class RepositoryDarcsTest < ActiveSupport::TestCase
48 @repository.fetch_changesets
49 @repository.fetch_changesets
49 assert_equal 6, @repository.changesets.count
50 assert_equal 6, @repository.changesets.count
50 end
51 end
51
52
52 def test_deleted_files_should_not_be_listed
53 def test_deleted_files_should_not_be_listed
54 @repository.fetch_changesets
55 @repository.reload
53 entries = @repository.entries('sources')
56 entries = @repository.entries('sources')
54 assert entries.detect {|e| e.name == 'watchers_controller.rb'}
57 assert entries.detect {|e| e.name == 'watchers_controller.rb'}
55 assert_nil entries.detect {|e| e.name == 'welcome_controller.rb'}
58 assert_nil entries.detect {|e| e.name == 'welcome_controller.rb'}
General Comments 0
You need to be logged in to leave comments. Login now