diff options
-rw-r--r-- | test/functional/attachments_controller_test.rb | 50 | ||||
-rw-r--r-- | test/functional/context_menus_controller_test.rb | 4 | ||||
-rw-r--r-- | test/functional/custom_fields_controller_test.rb | 2 | ||||
-rw-r--r-- | test/functional/documents_controller_test.rb | 17 | ||||
-rw-r--r-- | test/functional/enumerations_controller_test.rb | 6 | ||||
-rw-r--r-- | test/functional/files_controller_test.rb | 10 | ||||
-rw-r--r-- | test/functional/gantts_controller_test.rb | 6 | ||||
-rw-r--r-- | test/functional/journals_controller_test.rb | 8 |
8 files changed, 41 insertions, 62 deletions
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb index 4da2f5f66..19e4d0c09 100644 --- a/test/functional/attachments_controller_test.rb +++ b/test/functional/attachments_controller_test.rb @@ -40,12 +40,8 @@ class AttachmentsControllerTest < ActionController::TestCase assert_response :success assert_template 'diff' assert_equal 'text/html', @response.content_type - assert_tag 'th', - :attributes => {:class => /filename/}, - :content => /issues_controller.rb\t\(révision 1484\)/ - assert_tag 'td', - :attributes => {:class => /line-code/}, - :content => /Demande créée avec succès/ + assert_select 'th.filename', :text => /issues_controller.rb\t\(révision 1484\)/ + assert_select 'td.line-code', :text => /Demande créée avec succès/ end set_tmp_attachments_directory end @@ -58,12 +54,8 @@ class AttachmentsControllerTest < ActionController::TestCase assert_response :success assert_template 'diff' assert_equal 'text/html', @response.content_type - assert_tag 'th', - :attributes => {:class => "filename"}, - :content => /issues_controller.rb\t\(r\?vision 1484\)/ - assert_tag 'td', - :attributes => {:class => /line-code/}, - :content => /Demande cr\?\?e avec succ\?s/ + assert_select 'th.filename', :text => /issues_controller.rb\t\(r\?vision 1484\)/ + assert_select 'td.line-code', :text => /Demande cr\?\?e avec succ\?s/ end end set_tmp_attachments_directory @@ -77,12 +69,8 @@ class AttachmentsControllerTest < ActionController::TestCase assert_response :success assert_template 'diff' assert_equal 'text/html', @response.content_type - assert_tag 'th', - :attributes => {:class => "filename"}, - :content => /issues_controller.rb\t\(révision 1484\)/ - assert_tag 'td', - :attributes => {:class => /line-code/}, - :content => /Demande créée avec succès/ + assert_select 'th.filename', :text => /issues_controller.rb\t\(révision 1484\)/ + assert_select 'td.line-code', :text => /Demande créée avec succès/ end end set_tmp_attachments_directory @@ -145,10 +133,10 @@ class AttachmentsControllerTest < ActionController::TestCase assert_response :success assert_template 'file' assert_equal 'text/html', @response.content_type - assert_tag :tag => 'th', - :content => '1', - :attributes => { :class => 'line-num' }, - :sibling => { :tag => 'td', :content => /#{str_japanese}/ } + assert_select 'tr#L1' do + assert_select 'th.line-num', :text => '1' + assert_select 'td', :text => /#{str_japanese}/ + end end def test_show_text_file_replace_cannot_convert_content @@ -164,10 +152,10 @@ class AttachmentsControllerTest < ActionController::TestCase assert_response :success assert_template 'file' assert_equal 'text/html', @response.content_type - assert_tag :tag => 'th', - :content => '7', - :attributes => { :class => 'line-num' }, - :sibling => { :tag => 'td', :content => /Demande cr\?\?e avec succ\?s/ } + assert_select 'tr#L7' do + assert_select 'th.line-num', :text => '7' + assert_select 'td', :text => /Demande cr\?\?e avec succ\?s/ + end end end @@ -184,11 +172,11 @@ class AttachmentsControllerTest < ActionController::TestCase assert_response :success assert_template 'file' assert_equal 'text/html', @response.content_type - assert_tag :tag => 'th', - :content => '7', - :attributes => { :class => 'line-num' }, - :sibling => { :tag => 'td', :content => /Demande créée avec succès/ } + assert_select 'tr#L7' do + assert_select 'th.line-num', :text => '7' + assert_select 'td', :text => /Demande créée avec succès/ end + end end def test_show_text_file_should_send_if_too_big @@ -218,7 +206,7 @@ class AttachmentsControllerTest < ActionController::TestCase @request.session[:user_id] = 2 get :show, :id => 15 assert_response :success - assert_tag 'h2', :content => /private.diff/ + assert_select 'h2', :text => /private.diff/ set_tmp_attachments_directory end diff --git a/test/functional/context_menus_controller_test.rb b/test/functional/context_menus_controller_test.rb index 3a18ca30a..ec62d4307 100644 --- a/test/functional/context_menus_controller_test.rb +++ b/test/functional/context_menus_controller_test.rb @@ -60,9 +60,7 @@ class ContextMenusControllerTest < ActionController::TestCase get :issues, :ids => [1] assert_response :success assert_template 'context_menus/issues' - assert_tag :tag => 'a', :content => 'Delete', - :attributes => { :href => '#', - :class => 'icon-del disabled' } + assert_select 'a.icon-del.disabled[href="#"]', :text => 'Delete' end end diff --git a/test/functional/custom_fields_controller_test.rb b/test/functional/custom_fields_controller_test.rb index caae908b3..ab051a63c 100644 --- a/test/functional/custom_fields_controller_test.rb +++ b/test/functional/custom_fields_controller_test.rb @@ -192,7 +192,7 @@ class CustomFieldsControllerTest < ActionController::TestCase get :edit, :id => 1 assert_response :success assert_template 'edit' - assert_tag 'input', :attributes => {:name => 'custom_field[name]', :value => 'Database'} + assert_select 'input[name=?][value=?]', 'custom_field[name]', 'Database' end def test_edit_invalid_custom_field_should_render_404 diff --git a/test/functional/documents_controller_test.rb b/test/functional/documents_controller_test.rb index 4b3085565..2b1a96127 100644 --- a/test/functional/documents_controller_test.rb +++ b/test/functional/documents_controller_test.rb @@ -37,31 +37,30 @@ class DocumentsControllerTest < ActionController::TestCase assert_not_nil assigns(:grouped) # Default category selected in the new document form - assert_tag :select, :attributes => {:name => 'document[category_id]'}, - :child => {:tag => 'option', :attributes => {:selected => 'selected'}, - :content => 'Technical documentation'} + assert_select 'select[name=?]', 'document[category_id]' do + assert_select 'option[selected=selected]', :text => 'Technical documentation' - assert ! DocumentCategory.find(16).active? - assert_no_tag :option, :attributes => {:value => '16'}, - :parent => {:tag => 'select', :attributes => {:id => 'document_category_id'} } + assert ! DocumentCategory.find(16).active? + assert_select 'option[value="16"]', 0 + end end def test_index_grouped_by_date get :index, :project_id => 'ecookbook', :sort_by => 'date' assert_response :success - assert_tag 'h3', :content => '2007-02-12' + assert_select 'h3', :text => '2007-02-12' end def test_index_grouped_by_title get :index, :project_id => 'ecookbook', :sort_by => 'title' assert_response :success - assert_tag 'h3', :content => 'T' + assert_select 'h3', :text => 'T' end def test_index_grouped_by_author get :index, :project_id => 'ecookbook', :sort_by => 'author' assert_response :success - assert_tag 'h3', :content => 'John Smith' + assert_select 'h3', :text => 'John Smith' end def test_index_with_long_description diff --git a/test/functional/enumerations_controller_test.rb b/test/functional/enumerations_controller_test.rb index 626bc3196..0f189c00a 100644 --- a/test/functional/enumerations_controller_test.rb +++ b/test/functional/enumerations_controller_test.rb @@ -41,8 +41,8 @@ class EnumerationsControllerTest < ActionController::TestCase assert_response :success assert_template 'new' assert_kind_of IssuePriority, assigns(:enumeration) - assert_tag 'input', :attributes => {:name => 'enumeration[type]', :value => 'IssuePriority'} - assert_tag 'input', :attributes => {:name => 'enumeration[name]'} + assert_select 'input[name=?][value=?]', 'enumeration[type]', 'IssuePriority' + assert_select 'input[name=?]', 'enumeration[name]' end def test_new_with_invalid_type_should_respond_with_404 @@ -71,7 +71,7 @@ class EnumerationsControllerTest < ActionController::TestCase get :edit, :id => 6 assert_response :success assert_template 'edit' - assert_tag 'input', :attributes => {:name => 'enumeration[name]', :value => 'High'} + assert_select 'input[name=?][value=?]', 'enumeration[name]', 'High' end def test_edit_invalid_should_respond_with_404 diff --git a/test/functional/files_controller_test.rb b/test/functional/files_controller_test.rb index 577a05f44..0c3043bf5 100644 --- a/test/functional/files_controller_test.rb +++ b/test/functional/files_controller_test.rb @@ -41,12 +41,10 @@ class FilesControllerTest < ActionController::TestCase assert_not_nil assigns(:containers) # file attached to the project - assert_tag :a, :content => 'project_file.zip', - :attributes => { :href => '/attachments/download/8/project_file.zip' } + assert_select 'a[href=?]', '/attachments/download/8/project_file.zip', :text => 'project_file.zip' # file attached to a project's version - assert_tag :a, :content => 'version_file.zip', - :attributes => { :href => '/attachments/download/9/version_file.zip' } + assert_select 'a[href=?]', '/attachments/download/9/version_file.zip', :text => 'version_file.zip' end def test_new @@ -55,7 +53,7 @@ class FilesControllerTest < ActionController::TestCase assert_response :success assert_template 'new' - assert_tag 'select', :attributes => {:name => 'version_id'} + assert_select 'select[name=?]', 'version_id' end def test_new_without_versions @@ -65,7 +63,7 @@ class FilesControllerTest < ActionController::TestCase assert_response :success assert_template 'new' - assert_no_tag 'select', :attributes => {:name => 'version_id'} + assert_select 'select[name=?]', 'version_id', 0 end def test_create_file diff --git a/test/functional/gantts_controller_test.rb b/test/functional/gantts_controller_test.rb index 5b7135159..147100b08 100644 --- a/test/functional/gantts_controller_test.rb +++ b/test/functional/gantts_controller_test.rb @@ -73,11 +73,11 @@ class GanttsControllerTest < ActionController::TestCase get :show assert_response :success assert_template 'gantts/show' - assert_tag 'a', :content => /eCookbook/ + assert_select 'a', :text => /eCookbook/ # Root private project - assert_no_tag 'a', {:content => /OnlineStore/} + assert_select 'a', :text => /OnlineStore/, :count => 0 # Private children of a public project - assert_no_tag 'a', :content => /Private child of eCookbook/ + assert_select 'a', :text => /Private child of eCookbook/, :count => 0 end def test_gantt_should_display_relations diff --git a/test/functional/journals_controller_test.rb b/test/functional/journals_controller_test.rb index 36253f50c..d281be5a4 100644 --- a/test/functional/journals_controller_test.rb +++ b/test/functional/journals_controller_test.rb @@ -51,12 +51,8 @@ class JournalsControllerTest < ActionController::TestCase assert_response :success assert_template 'diff' - assert_tag 'span', - :attributes => {:class => 'diff_out'}, - :content => /removed/ - assert_tag 'span', - :attributes => {:class => 'diff_in'}, - :content => /added/ + assert_select 'span.diff_out', :text => /removed/ + assert_select 'span.diff_in', :text => /added/ end def test_reply_to_issue |