From ea60705ca74a506963cf6656b181fea6c1e76135 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Wed, 5 Jan 2011 15:11:47 +0000 Subject: [PATCH] Merged r4635 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.1-stable@4641 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../repositories_mercurial_controller_test.rb | 16 +++++++++++++++- test/unit/repository_mercurial_test.rb | 16 ++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb index 492c6558e..b577da87e 100644 --- a/test/functional/repositories_mercurial_controller_test.rb +++ b/test/functional/repositories_mercurial_controller_test.rb @@ -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 diff --git a/test/unit/repository_mercurial_test.rb b/test/unit/repository_mercurial_test.rb index 741b455e5..481a223b8 100644 --- a/test/unit/repository_mercurial_test.rb +++ b/test/unit/repository_mercurial_test.rb @@ -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 -- 2.39.5