Use assert_select instead of assert_tag.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10106 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-07-28 18:16:55 +00:00
parent 65524cc1cc
commit 71c5d6c8ee
3 changed files with 25 additions and 68 deletions

View File

@ -217,34 +217,19 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
assert_response :success assert_response :success
assert_template 'annotate' assert_template 'annotate'
# 1.1 line # 1.1 line
assert_tag :tag => 'th', assert_select 'tr' do
:attributes => { :class => 'line-num' }, assert_select 'th.line-num', :text => '21'
:content => '21', assert_select 'td.revision', :text => /1.1/
:sibling => { assert_select 'td.author', :text => /LANG/
:tag => 'td', end
:attributes => { :class => 'revision' },
:content => /1.1/,
:sibling => {
:tag => 'td',
:attributes => { :class => 'author' },
:content => /LANG/
}
}
# 1.2 line # 1.2 line
assert_tag :tag => 'th', assert_select 'tr' do
:attributes => { :class => 'line-num' }, assert_select 'th.line-num', :text => '32'
:content => '32', assert_select 'td.revision', :text => /1.2/
:sibling => { assert_select 'td.author', :text => /LANG/
:tag => 'td', end
:attributes => { :class => 'revision' },
:content => /1.2/,
:sibling => {
:tag => 'td',
:attributes => { :class => 'author' },
:content => /LANG/
}
}
end end
def test_destroy_valid_repository def test_destroy_valid_repository

View File

@ -383,27 +383,14 @@ class RepositoriesGitControllerTest < ActionController::TestCase
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
assert_response :success assert_response :success
assert_template 'annotate' assert_template 'annotate'
# Line 23, changeset 2f9c0091 # Line 23, changeset 2f9c0091
assert_tag :tag => 'th', :content => '23', assert_select 'tr' do
:sibling => { assert_select 'th.line-num', :text => '23'
:tag => 'td', assert_select 'td.revision', :text => /2f9c0091/
:child => { assert_select 'td.author', :text => 'jsmith'
:tag => 'a', assert_select 'td', :text => /remove_watcher/
:content => /2f9c0091/ end
}
}
assert_tag :tag => 'th', :content => '23',
:sibling => { :tag => 'td', :content => /jsmith/ }
assert_tag :tag => 'th', :content => '23',
:sibling => {
:tag => 'td',
:child => {
:tag => 'a',
:content => /2f9c0091/
}
}
assert_tag :tag => 'th', :content => '23',
:sibling => { :tag => 'td', :content => /remove_watcher/ }
end end
def test_annotate_at_given_revision def test_annotate_at_given_revision

View File

@ -376,29 +376,14 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
assert_response :success assert_response :success
assert_template 'annotate' assert_template 'annotate'
# Line 22, revision 4:def6d2f1254a # Line 22, revision 4:def6d2f1254a
assert_tag :tag => 'th', assert_select 'tr' do
:content => '22', assert_select 'th.line-num', :text => '22'
:attributes => { :class => 'line-num' }, assert_select 'td.revision', :text => '4:def6d2f1254a'
:sibling => assert_select 'td.author', :text => 'jsmith'
{ assert_select 'td', :text => /remove_watcher/
:tag => 'td', end
:attributes => { :class => 'revision' },
:child => { :tag => 'a', :content => '4:def6d2f1254a' }
}
assert_tag :tag => 'th',
:content => '22',
:attributes => { :class => 'line-num' },
:sibling =>
{
:tag => 'td' ,
:content => 'jsmith' ,
:attributes => { :class => 'author' },
}
assert_tag :tag => 'th',
:content => '22',
:attributes => { :class => 'line-num' },
:sibling => { :tag => 'td', :content => /remove_watcher/ }
end end
def test_annotate_not_in_tip def test_annotate_not_in_tip