]> source.dussan.org Git - redmine.git/commitdiff
scm: bazaar: add test to override human_attribute_name of "path to repository"
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 24 Feb 2012 10:02:20 +0000 (10:02 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 24 Feb 2012 10:02:20 +0000 (10:02 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8960 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/repository_bazaar_test.rb

index 96994736aa600154e3a6f17c3bdb469defcf9fad..af92764fe0aa192b7235a86d851e973378a2ef41 100644 (file)
@@ -20,6 +20,8 @@ require File.expand_path('../../test_helper', __FILE__)
 class RepositoryBazaarTest < ActiveSupport::TestCase
   fixtures :projects
 
+  include Redmine::I18n
+
   REPOSITORY_PATH = Rails.root.join('tmp/test/bazaar_repository/trunk').to_s
   REPOSITORY_PATH.gsub!(/\/+/, '/')
   NUM_REV = 4
@@ -32,6 +34,32 @@ class RepositoryBazaarTest < ActiveSupport::TestCase
     assert @repository
   end
 
+  def test_blank_path_to_repository_error_message
+    set_language_if_valid 'en'
+    repo = Repository::Bazaar.new(
+                          :project      => @project,
+                          :identifier   => 'test',
+                          :log_encoding => 'UTF-8'
+                        )
+    assert !repo.save
+    assert_include "Path to repository can't be blank",
+                   repo.errors.full_messages
+  end
+
+  def test_blank_path_to_repository_error_message_fr
+    set_language_if_valid 'fr'
+    str = "Chemin du d\xc3\xa9p\xc3\xb4t doit \xc3\xaatre renseign\xc3\xa9(e)"
+    str.force_encoding('UTF-8') if str.respond_to?(:force_encoding)
+    repo = Repository::Bazaar.new(
+                          :project      => @project,
+                          :url          => "",
+                          :identifier   => 'test',
+                          :log_encoding => 'UTF-8'
+                        )
+    assert !repo.save
+    assert_include str, repo.errors.full_messages
+  end
+
   if File.directory?(REPOSITORY_PATH)
     def test_fetch_changesets_from_scratch
       assert_equal 0, @repository.changesets.count