Mercurial > hg > soundsoftware-site
diff test/unit/repository_filesystem_test.rb @ 1337:077b8890835a cannam
Merge from live branch
author | Chris Cannam |
---|---|
date | Thu, 20 Jun 2013 13:14:02 +0100 |
parents | 433d4f72a19b |
children | 622f24f53b42 |
line wrap: on
line diff
--- a/test/unit/repository_filesystem_test.rb Fri Jun 14 11:30:07 2013 +0100 +++ b/test/unit/repository_filesystem_test.rb Thu Jun 20 13:14:02 2013 +0100 @@ -1,5 +1,5 @@ # Redmine - project management software -# Copyright (C) 2006-2011 Jean-Philippe Lang +# Copyright (C) 2006-2012 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -20,6 +20,8 @@ class RepositoryFilesystemTest < ActiveSupport::TestCase fixtures :projects + include Redmine::I18n + REPOSITORY_PATH = Rails.root.join('tmp/test/filesystem_repository').to_s def setup @@ -32,18 +34,48 @@ assert @repository end + def test_blank_root_directory_error_message + set_language_if_valid 'en' + repo = Repository::Filesystem.new( + :project => @project, + :identifier => 'test' + ) + assert !repo.save + assert_include "Root directory can't be blank", + repo.errors.full_messages + end + + def test_blank_root_directory_error_message_fr + set_language_if_valid 'fr' + str = "R\xc3\xa9pertoire racine doit \xc3\xaatre renseign\xc3\xa9(e)" + str.force_encoding('UTF-8') if str.respond_to?(:force_encoding) + repo = Repository::Filesystem.new( + :project => @project, + :url => "", + :identifier => 'test', + :path_encoding => '' + ) + assert !repo.save + assert_include str, repo.errors.full_messages + end + if File.directory?(REPOSITORY_PATH) def test_fetch_changesets assert_equal 0, @repository.changesets.count - assert_equal 0, @repository.changes.count + assert_equal 0, @repository.filechanges.count @repository.fetch_changesets @project.reload assert_equal 0, @repository.changesets.count - assert_equal 0, @repository.changes.count + assert_equal 0, @repository.filechanges.count end def test_entries - assert_equal 3, @repository.entries("", 2).size + entries = @repository.entries("", 2) + assert_kind_of Redmine::Scm::Adapters::Entries, entries + assert_equal 3, entries.size + end + + def test_entries_in_directory assert_equal 2, @repository.entries("dir", 3).size end