From 71c5d6c8ee4c15432d62e268133725f7292d8d89 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 28 Jul 2012 18:16:55 +0000 Subject: [PATCH] Use assert_select instead of assert_tag. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10106 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../repositories_cvs_controller_test.rb | 37 ++++++------------- .../repositories_git_controller_test.rb | 27 ++++---------- .../repositories_mercurial_controller_test.rb | 29 ++++----------- 3 files changed, 25 insertions(+), 68 deletions(-) diff --git a/test/functional/repositories_cvs_controller_test.rb b/test/functional/repositories_cvs_controller_test.rb index 9a685754e..c3a510ab3 100644 --- a/test/functional/repositories_cvs_controller_test.rb +++ b/test/functional/repositories_cvs_controller_test.rb @@ -217,34 +217,19 @@ class RepositoriesCvsControllerTest < ActionController::TestCase :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] assert_response :success assert_template 'annotate' + # 1.1 line - assert_tag :tag => 'th', - :attributes => { :class => 'line-num' }, - :content => '21', - :sibling => { - :tag => 'td', - :attributes => { :class => 'revision' }, - :content => /1.1/, - :sibling => { - :tag => 'td', - :attributes => { :class => 'author' }, - :content => /LANG/ - } - } + assert_select 'tr' do + assert_select 'th.line-num', :text => '21' + assert_select 'td.revision', :text => /1.1/ + assert_select 'td.author', :text => /LANG/ + end # 1.2 line - assert_tag :tag => 'th', - :attributes => { :class => 'line-num' }, - :content => '32', - :sibling => { - :tag => 'td', - :attributes => { :class => 'revision' }, - :content => /1.2/, - :sibling => { - :tag => 'td', - :attributes => { :class => 'author' }, - :content => /LANG/ - } - } + assert_select 'tr' do + assert_select 'th.line-num', :text => '32' + assert_select 'td.revision', :text => /1.2/ + assert_select 'td.author', :text => /LANG/ + end end def test_destroy_valid_repository diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb index 786238493..333f379f3 100644 --- a/test/functional/repositories_git_controller_test.rb +++ b/test/functional/repositories_git_controller_test.rb @@ -383,27 +383,14 @@ class RepositoriesGitControllerTest < ActionController::TestCase :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] assert_response :success assert_template 'annotate' + # Line 23, changeset 2f9c0091 - assert_tag :tag => 'th', :content => '23', - :sibling => { - :tag => 'td', - :child => { - :tag => 'a', - :content => /2f9c0091/ - } - } - 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/ } + assert_select 'tr' do + assert_select 'th.line-num', :text => '23' + assert_select 'td.revision', :text => /2f9c0091/ + assert_select 'td.author', :text => 'jsmith' + assert_select 'td', :text => /remove_watcher/ + end end def test_annotate_at_given_revision diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb index 42e3f5897..bfcf2d669 100644 --- a/test/functional/repositories_mercurial_controller_test.rb +++ b/test/functional/repositories_mercurial_controller_test.rb @@ -376,29 +376,14 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase :path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param] assert_response :success assert_template 'annotate' + # Line 22, revision 4:def6d2f1254a - assert_tag :tag => 'th', - :content => '22', - :attributes => { :class => 'line-num' }, - :sibling => - { - :tag => 'td', - :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/ } + assert_select 'tr' do + assert_select 'th.line-num', :text => '22' + assert_select 'td.revision', :text => '4:def6d2f1254a' + assert_select 'td.author', :text => 'jsmith' + assert_select 'td', :text => /remove_watcher/ + end end def test_annotate_not_in_tip -- 2.39.5