diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-09-26 21:54:52 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-09-26 21:54:52 +0000 |
commit | ffb3d9260aa04fbd340652631e5df1d440740181 (patch) | |
tree | 726e5fe249155f497d83887f565686cf5bc11eff /test | |
parent | bd511194607b33cf504de11f0a70c71cd6898192 (diff) | |
download | redmine-ffb3d9260aa04fbd340652631e5df1d440740181.tar.gz redmine-ffb3d9260aa04fbd340652631e5df1d440740181.zip |
Support leading and trailing spaces in filenames or directories in the git adapter. #6499
Contributed by Felix Schäfer
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4189 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/repositories/git_repository.tar.gz | bin | 20118 -> 20711 bytes | |||
-rw-r--r-- | test/functional/repositories_git_controller_test.rb | 3 | ||||
-rw-r--r-- | test/unit/lib/redmine/scm/adapters/git_adapter_test.rb | 10 | ||||
-rw-r--r-- | test/unit/repository_git_test.rb | 8 |
4 files changed, 15 insertions, 6 deletions
diff --git a/test/fixtures/repositories/git_repository.tar.gz b/test/fixtures/repositories/git_repository.tar.gz Binary files differindex 8a07a230c..17cb22943 100644 --- a/test/fixtures/repositories/git_repository.tar.gz +++ b/test/fixtures/repositories/git_repository.tar.gz diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb index bea9663c2..941fbcf1b 100644 --- a/test/functional/repositories_git_controller_test.rb +++ b/test/functional/repositories_git_controller_test.rb @@ -50,7 +50,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase assert_response :success assert_template 'show' assert_not_nil assigns(:entries) - assert_equal 8, assigns(:entries).size + assert_equal 9, assigns(:entries).size assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'} assert assigns(:entries).detect {|e| e.name == 'this_is_a_really_long_and_verbose_directory_name' && e.kind == 'dir'} assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'} @@ -59,6 +59,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase assert assigns(:entries).detect {|e| e.name == 'new_file.txt' && e.kind == 'file'} assert assigns(:entries).detect {|e| e.name == 'renamed_test.txt' && e.kind == 'file'} assert assigns(:entries).detect {|e| e.name == 'filemane with spaces.txt' && e.kind == 'file'} + assert assigns(:entries).detect {|e| e.name == ' filename with a leading space.txt ' && e.kind == 'file'} end def test_browse_branch diff --git a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb index 76dca9ed6..45e3a5adb 100644 --- a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb @@ -13,7 +13,7 @@ class GitAdapterTest < ActiveSupport::TestCase end def test_getting_all_revisions - assert_equal 14, @adapter.revisions('',nil,nil,:all => true).length + assert_equal 15, @adapter.revisions('',nil,nil,:all => true).length end def test_getting_certain_revisions @@ -24,6 +24,14 @@ class GitAdapterTest < ActiveSupport::TestCase assert_equal 1, @adapter.revisions("filemane with spaces.txt", nil, nil, :all => true).length end + def test_getting_revisions_with_leading_and_trailing_spaces_in_filename + assert_equal " filename with a leading space.txt ", @adapter.revisions(" filename with a leading space.txt ", nil, nil, :all => true)[0].paths[0][:path] + end + + def test_getting_entries_with_leading_and_trailing_spaces_in_filename + assert_equal " filename with a leading space.txt ", @adapter.entries('', '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c')[3].name + end + def test_annotate annotate = @adapter.annotate('sources/watchers_controller.rb') assert_kind_of Redmine::Scm::Adapters::Annotate, annotate diff --git a/test/unit/repository_git_test.rb b/test/unit/repository_git_test.rb index 4f6087511..5ae889492 100644 --- a/test/unit/repository_git_test.rb +++ b/test/unit/repository_git_test.rb @@ -34,8 +34,8 @@ class RepositoryGitTest < ActiveSupport::TestCase @repository.fetch_changesets @repository.reload - assert_equal 14, @repository.changesets.count - assert_equal 23, @repository.changes.count + assert_equal 15, @repository.changesets.count + assert_equal 24, @repository.changes.count commit = @repository.changesets.find(:first, :order => 'committed_on ASC') assert_equal "Initial import.\nThe repository contains 3 files.", commit.comments @@ -57,10 +57,10 @@ class RepositoryGitTest < ActiveSupport::TestCase # Remove the 3 latest changesets @repository.changesets.find(:all, :order => 'committed_on DESC', :limit => 3).each(&:destroy) @repository.reload - assert_equal 11, @repository.changesets.count + assert_equal 12, @repository.changesets.count @repository.fetch_changesets - assert_equal 14, @repository.changesets.count + assert_equal 15, @repository.changesets.count end else puts "Git test repository NOT FOUND. Skipping unit tests !!!" |