scm: mercurial: add some tests at unit and functional test.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4635 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
9ee02d04f3
commit
f4c5fe43cb
|
@ -74,7 +74,21 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase
|
|||
assert_not_nil assigns(:entries)
|
||||
assert_equal ['delete.png'], assigns(:entries).collect(&:name)
|
||||
end
|
||||
|
||||
|
||||
def test_show_directory_sql_escape_percent
|
||||
get :show, :id => 3, :path => ['sql_escape', 'percent%dir'], :rev => 13
|
||||
assert_response :success
|
||||
assert_template 'show'
|
||||
|
||||
assert_not_nil assigns(:entries)
|
||||
assert_equal ['percent%file1.txt', 'percentfile1.txt'], assigns(:entries).collect(&:name)
|
||||
changesets = assigns(:changesets)
|
||||
|
||||
## This is not yet implemented.
|
||||
# assert_not_nil changesets
|
||||
# assert_equal %w(13 11 10 9), changesets.collect(&:revision)
|
||||
end
|
||||
|
||||
def test_changes
|
||||
get :changes, :id => 3, :path => ['images', 'edit.png']
|
||||
assert_response :success
|
||||
|
|
|
@ -80,6 +80,22 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
|
|||
assert c0.revision.to_i > c1.revision.to_i
|
||||
assert c0.committed_on < c1.committed_on
|
||||
end
|
||||
|
||||
def test_latest_changesets
|
||||
@repository.fetch_changesets
|
||||
@repository.reload
|
||||
|
||||
# with_limit
|
||||
changesets = @repository.latest_changesets('', nil, 2)
|
||||
assert_equal @repository.latest_changesets('', nil)[0, 2], changesets
|
||||
|
||||
# with_filepath
|
||||
changesets = @repository.latest_changesets('/sql_escape/percent%dir/percent%file1.txt', nil)
|
||||
assert_equal %w|11 10 9|, changesets.collect(&:revision)
|
||||
|
||||
changesets = @repository.latest_changesets('/sql_escape/underscore_dir/understrike_file.txt', nil)
|
||||
assert_equal %w|12 9|, changesets.collect(&:revision)
|
||||
end
|
||||
else
|
||||
puts "Mercurial test repository NOT FOUND. Skipping unit tests !!!"
|
||||
def test_fake; assert true end
|
||||
|
|
Loading…
Reference in New Issue