]> source.dussan.org Git - redmine.git/commitdiff
scm: add test to override human_attribute_name of log_encoding
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 24 Feb 2012 04:08:47 +0000 (04:08 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 24 Feb 2012 04:08:47 +0000 (04:08 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8957 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/repository_test.rb

index 51a5c229d5a624ad616320aa29b5e9cb16680219..04f788117a0eabf4557f5cd2ed7a88b1e2d8e2aa 100644 (file)
@@ -34,10 +34,36 @@ class RepositoryTest < ActiveSupport::TestCase
            :roles,
            :enumerations
 
+  include Redmine::I18n
+
   def setup
     @repository = Project.find(1).repository
   end
 
+  def test_blank_log_encoding_error_message
+    set_language_if_valid 'en'
+    repo = Repository::Bazaar.new(
+                        :project      => Project.find(3),
+                        :url          => "/test",
+                        :log_encoding => ''
+                      )
+    assert !repo.save
+    assert_include "Commit messages encoding can't be blank",
+                   repo.errors.full_messages
+  end
+
+  def test_blank_log_encoding_error_message_fr
+    set_language_if_valid 'fr'
+    str = "Encodage des messages de commit doit \xc3\xaatre renseign\xc3\xa9(e)"
+    str.force_encoding('UTF-8') if str.respond_to?(:force_encoding)
+    repo = Repository::Bazaar.new(
+                        :project      => Project.find(3),
+                        :url          => "/test"
+                      )
+    assert !repo.save
+    assert_include str, repo.errors.full_messages
+  end
+
   def test_create
     repository = Repository::Subversion.new(:project => Project.find(3))
     assert !repository.save