Browse files

Merged r6206 from trunk.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.2-stable@6207 e93f8b46-1217-0410-a6f0-8f06a7374b81
  • Loading branch information...
1 parent 0527e8c commit a8550ba8a633b5874224efbebee756d6dbd155c1 @jplang jplang committed Jul 9, 2011
Showing with 22 additions and 8 deletions.
  1. +5 −1 app/models/wiki_page.rb
  2. +17 −7 test/functional/wiki_controller_test.rb
View
6 app/models/wiki_page.rb
@@ -212,6 +212,10 @@ def initialize(content)
break unless @lines.detect { |line| line[0].nil? }
current = current.previous
end
- @lines.each { |line| line[0] ||= current.version }
+ @lines.each { |line|
+ line[0] ||= current.version
+ # if the last known version is > 1 (eg. history was cleared), we don't know the author
+ line[1] ||= current.author if current.version == 1
+ }
end
end
View
24 test/functional/wiki_controller_test.rb
@@ -250,14 +250,24 @@ def test_annotate
get :annotate, :project_id => 1, :id => 'CookBook_documentation', :version => 2
assert_response :success
assert_template 'annotate'
+
# Line 1
- assert_tag :tag => 'tr', :child => { :tag => 'th', :attributes => {:class => 'line-num'}, :content => '1' },
- :child => { :tag => 'td', :attributes => {:class => 'author'}, :content => /John Smith/ },
- :child => { :tag => 'td', :content => /h1\. CookBook documentation/ }
- # Line 2
- assert_tag :tag => 'tr', :child => { :tag => 'th', :attributes => {:class => 'line-num'}, :content => '2' },
- :child => { :tag => 'td', :attributes => {:class => 'author'}, :content => /redMine Admin/ },
- :child => { :tag => 'td', :content => /Some updated \[\[documentation\]\] here/ }
+ assert_tag :tag => 'tr', :child => {
+ :tag => 'th', :attributes => {:class => 'line-num'}, :content => '1', :sibling => {
+ :tag => 'td', :attributes => {:class => 'author'}, :content => /John Smith/, :sibling => {
+ :tag => 'td', :content => /h1\. CookBook documentation/
+ }
+ }
+ }
+
+ # Line 5
+ assert_tag :tag => 'tr', :child => {
+ :tag => 'th', :attributes => {:class => 'line-num'}, :content => '5', :sibling => {
+ :tag => 'td', :attributes => {:class => 'author'}, :content => /redMine Admin/, :sibling => {
+ :tag => 'td', :content => /Some updated \[\[documentation\]\] here/
+ }
+ }
+ }
end
def test_get_rename

0 comments on commit a8550ba

Please sign in to comment.