diff test/functional/repositories_git_controller_test.rb @ 1526:404aa68d4227

Merge from live branch
author Chris Cannam
date Thu, 11 Sep 2014 12:46:20 +0100
parents dffacf8a6908
children
line wrap: on
line diff
--- a/test/functional/repositories_git_controller_test.rb	Mon Mar 17 08:57:04 2014 +0000
+++ b/test/functional/repositories_git_controller_test.rb	Thu Sep 11 12:46:20 2014 +0100
@@ -1,5 +1,5 @@
 # Redmine - project management software
-# Copyright (C) 2006-2012  Jean-Philippe Lang
+# Copyright (C) 2006-2014  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
@@ -27,6 +27,7 @@
   REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
   PRJ_ID     = 3
   CHAR_1_HEX = "\xc3\x9c"
+  FELIX_HEX  = "Felix Sch\xC3\xA4fer"
   NUM_REV = 28
 
   ## Git, Mercurial and CVS path encodings are binary.
@@ -50,8 +51,10 @@
                       )
     assert @repository
     @char_1        = CHAR_1_HEX.dup
+    @felix_utf8  = FELIX_HEX.dup
     if @char_1.respond_to?(:force_encoding)
       @char_1.force_encoding('UTF-8')
+      @felix_utf8.force_encoding('UTF-8')
     end
   end
 
@@ -68,7 +71,7 @@
                      }
     end
     assert_response 302
-    repository = Repository.first(:order => 'id DESC')
+    repository = Repository.order('id DESC').first
     assert_kind_of Repository::Git, repository
     assert_equal '/test', repository.url
     assert_equal true, repository.extra_report_last_commit
@@ -532,11 +535,32 @@
             get :annotate, :id => PRJ_ID,
                 :path => repository_path_hash(['latin-1-dir', "test-#{@char_1}.txt"])[:param],
                 :rev => r1
-            assert_tag :tag => 'th',
-                       :content => '1',
-                       :attributes => { :class => 'line-num' },
-                       :sibling => { :tag => 'td',
-                                     :content => /test-#{@char_1}.txt/ }
+            assert_select "th.line-num", :text => '1' do
+              assert_select "+ td.revision" do
+                assert_select "a", :text => '57ca437c'
+                assert_select "+ td.author", :text => "jsmith" do
+                  assert_select "+ td",
+                                :text => "test-#{@char_1}.txt"
+                end
+              end
+            end
+          end
+        end
+      end
+    end
+
+    def test_annotate_latin_1_author
+      ['83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', '83ca5fd546063a'].each do |r1|
+        get :annotate, :id => PRJ_ID,
+            :path => repository_path_hash([" filename with a leading space.txt "])[:param],
+            :rev => r1
+        assert_select "th.line-num", :text => '1' do
+          assert_select "+ td.revision" do
+            assert_select "a", :text => '83ca5fd5'
+            assert_select "+ td.author", :text => @felix_utf8 do
+              assert_select "+ td",
+                            :text => "And this is a file with a leading and trailing space..."
+            end
           end
         end
       end