Commit 6ed00a2e authored by jplang's avatar jplang

Replaced remaining #assert_tag with #assert_select.

git-svn-id: https://svn.redmine.org/redmine/trunk@13624 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 8e69977b
......@@ -166,7 +166,7 @@ class AccountControllerTest < ActionController::TestCase
post :login, :username => 'jsmith', :password => 'jsmith'
assert_response 500
assert_error_tag :content => /Something wrong/
assert_select_error /Something wrong/
end
def test_login_should_reset_session
......
......@@ -74,7 +74,7 @@ class AuthSourcesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'new'
end
assert_error_tag :content => /host #{ESCAPED_CANT} be blank/i
assert_select_error /host #{ESCAPED_CANT} be blank/i
end
def test_edit
......@@ -118,7 +118,7 @@ class AuthSourcesControllerTest < ActionController::TestCase
:port => '389', :attr_login => 'uid'}
assert_response :success
assert_template 'edit'
assert_error_tag :content => /host #{ESCAPED_CANT} be blank/i
assert_select_error /host #{ESCAPED_CANT} be blank/i
end
def test_destroy
......
......@@ -62,7 +62,7 @@ class IssueStatusesControllerTest < ActionController::TestCase
post :create, :issue_status => {:name => ''}
assert_response :success
assert_template 'new'
assert_error_tag :content => /name #{ESCAPED_CANT} be blank/i
assert_select_error /name #{ESCAPED_CANT} be blank/i
end
def test_edit
......@@ -82,7 +82,7 @@ class IssueStatusesControllerTest < ActionController::TestCase
put :update, :id => '3', :issue_status => {:name => ''}
assert_response :success
assert_template 'edit'
assert_error_tag :content => /name #{ESCAPED_CANT} be blank/i
assert_select_error /name #{ESCAPED_CANT} be blank/i
end
def test_destroy
......
......@@ -1729,7 +1729,7 @@ class IssuesControllerTest < ActionController::TestCase
get :new, :project_id => 1
assert_response 500
assert_error_tag :content => /No default issue/
assert_select_error /No default issue/
end
def test_get_new_with_no_tracker_should_display_an_error
......@@ -1738,7 +1738,7 @@ class IssuesControllerTest < ActionController::TestCase
get :new, :project_id => 1
assert_response 500
assert_error_tag :content => /No tracker/
assert_select_error /No tracker/
end
def test_update_form_for_new_issue
......@@ -1977,7 +1977,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_template 'new'
issue = assigns(:issue)
assert_not_nil issue
assert_error_tag :content => /Database #{ESCAPED_CANT} be blank/
assert_select_error /Database #{ESCAPED_CANT} be blank/
end
def test_create_should_validate_required_fields
......@@ -2001,8 +2001,8 @@ class IssuesControllerTest < ActionController::TestCase
assert_template 'new'
end
assert_error_tag :content => /Due date #{ESCAPED_CANT} be blank/i
assert_error_tag :content => /Bar #{ESCAPED_CANT} be blank/i
assert_select_error /Due date #{ESCAPED_CANT} be blank/i
assert_select_error /Bar #{ESCAPED_CANT} be blank/i
end
def test_create_should_ignore_readonly_fields
......@@ -2096,7 +2096,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_response :success
assert_select 'input[name=?][value=?]', 'issue[parent_issue_id]', '4'
assert_error_tag :content => /Parent task is invalid/i
assert_select_error /Parent task is invalid/i
end
end
......@@ -2111,7 +2111,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_response :success
assert_select 'input[name=?][value=?]', 'issue[parent_issue_id]', '01ABC'
assert_error_tag :content => /Parent task is invalid/i
assert_select_error /Parent task is invalid/i
end
end
......@@ -3219,7 +3219,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'edit'
assert_error_tag :descendant => {:content => /Activity #{ESCAPED_CANT} be blank/}
assert_select_error /Activity #{ESCAPED_CANT} be blank/
assert_select 'textarea[name=?]', 'issue[notes]', :text => notes
assert_select 'input[name=?][value=?]', 'time_entry[hours]', '2z'
end
......@@ -3237,8 +3237,8 @@ class IssuesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'edit'
assert_error_tag :descendant => {:content => /Activity #{ESCAPED_CANT} be blank/}
assert_error_tag :descendant => {:content => /Hours #{ESCAPED_CANT} be blank/}
assert_select_error /Activity #{ESCAPED_CANT} be blank/
assert_select_error /Hours #{ESCAPED_CANT} be blank/
assert_select 'textarea[name=?]', 'issue[notes]', :text => notes
assert_select 'input[name=?][value=?]', 'time_entry[comments]', 'this is my comment'
end
......
......@@ -103,8 +103,8 @@ class IssuesControllerTransactionTest < ActionController::TestCase
assert_response :success
assert_template 'edit'
attachment = Attachment.order('id DESC').first
assert_tag 'input', :attributes => {:name => 'attachments[p0][token]', :value => attachment.token}
assert_tag 'input', :attributes => {:name => 'attachments[p0][filename]', :value => 'testfile.txt'}
assert_select 'input[name=?][value=?]', 'attachments[p0][token]', attachment.token
assert_select 'input[name=?][value=?]', 'attachments[p0][filename]', 'testfile.txt'
end
def test_update_stale_issue_without_notes_should_not_show_add_notes_option
......@@ -118,10 +118,10 @@ class IssuesControllerTransactionTest < ActionController::TestCase
:lock_version => (issue.lock_version - 1)
}
assert_tag 'div', :attributes => {:class => 'conflict'}
assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'overwrite'}
assert_no_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'add_notes'}
assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'cancel'}
assert_select 'div.conflict'
assert_select 'input[name=conflict_resolution][value=overwrite]'
assert_select 'input[name=conflict_resolution][value=add_notes]', 0
assert_select 'input[name=conflict_resolution][value=cancel]'
end
def test_update_stale_issue_should_show_conflicting_journals
......@@ -138,8 +138,8 @@ class IssuesControllerTransactionTest < ActionController::TestCase
assert_not_nil assigns(:conflict_journals)
assert_equal 1, assigns(:conflict_journals).size
assert_equal 2, assigns(:conflict_journals).first.id
assert_tag 'div', :attributes => {:class => 'conflict'},
:descendant => {:content => /Some notes with Redmine links/}
assert_select 'div.conflict', :text => /Some notes with Redmine links/
end
def test_update_stale_issue_without_previous_journal_should_show_all_journals
......@@ -155,10 +155,8 @@ class IssuesControllerTransactionTest < ActionController::TestCase
assert_not_nil assigns(:conflict_journals)
assert_equal 2, assigns(:conflict_journals).size
assert_tag 'div', :attributes => {:class => 'conflict'},
:descendant => {:content => /Some notes with Redmine links/}
assert_tag 'div', :attributes => {:class => 'conflict'},
:descendant => {:content => /Journal notes/}
assert_select 'div.conflict', :text => /Some notes with Redmine links/
assert_select 'div.conflict', :text => /Journal notes/
end
def test_update_stale_issue_should_show_private_journals_with_permission_only
......@@ -256,7 +254,7 @@ class IssuesControllerTransactionTest < ActionController::TestCase
get :index
assert_response 500
assert_tag 'p', :content => /An error occurred/
assert_select 'p', :text => /An error occurred/
assert_nil session[:query]
assert_nil session[:issues_index_sort]
end
......
......@@ -39,9 +39,9 @@ class MessagesControllerTest < ActionController::TestCase
assert_response :success
# tags required by MessagesController#quote
assert_tag 'input', :attributes => {:id => 'message_subject'}
assert_tag 'textarea', :attributes => {:id => 'message_content'}
assert_tag 'div', :attributes => {:id => 'reply'}
assert_select 'input#message_subject'
assert_select 'textarea#message_content'
assert_select 'div#reply'
end
def test_show_with_pagination
......@@ -68,8 +68,7 @@ class MessagesControllerTest < ActionController::TestCase
get :show, :board_id => 1, :id => 1
assert_response :success
assert_template 'show'
assert_tag :div, :attributes => { :id => 'reply' },
:descendant => { :tag => 'textarea', :attributes => { :id => 'message_content' } }
assert_select 'div#reply textarea#message_content'
end
def test_show_message_not_found
......
......@@ -68,7 +68,7 @@ class MyControllerTest < ActionController::TestCase
assert_template 'account'
assert_equal User.find(2), assigns(:user)
assert_tag :input, :attributes => { :name => 'user[custom_field_values][4]'}
assert_select 'input[name=?]', 'user[custom_field_values][4]'
end
def test_my_account_should_not_show_non_editable_custom_fields
......@@ -79,7 +79,7 @@ class MyControllerTest < ActionController::TestCase
assert_template 'account'
assert_equal User.find(2), assigns(:user)
assert_no_tag :input, :attributes => { :name => 'user[custom_field_values][4]'}
assert_select 'input[name=?]', 'user[custom_field_values][4]', 0
end
def test_my_account_should_show_language_select
......@@ -167,7 +167,7 @@ class MyControllerTest < ActionController::TestCase
:new_password_confirmation => 'secret1234'
assert_response :success
assert_template 'password'
assert_error_tag :content => /Password doesn.*t match confirmation/
assert_select_error /Password doesn.*t match confirmation/
# wrong password
post :password, :password => 'wrongpassword',
......
......@@ -50,7 +50,7 @@ class NewsControllerTest < ActionController::TestCase
get :show, :id => 1
assert_response :success
assert_template 'show'
assert_tag :tag => 'h2', :content => /eCookbook first release/
assert_select 'h2', :text => /eCookbook first release/
end
def test_show_should_show_attachments
......@@ -60,7 +60,7 @@ class NewsControllerTest < ActionController::TestCase
get :show, :id => 1
assert_response :success
assert_tag 'a', :content => attachment.filename
assert_select 'a', :text => attachment.filename
end
def test_show_with_comments_in_reverse_order
......@@ -129,7 +129,7 @@ class NewsControllerTest < ActionController::TestCase
assert_template 'new'
assert_not_nil assigns(:news)
assert assigns(:news).new_record?
assert_error_tag :content => /title #{ESCAPED_CANT} be blank/i
assert_select_error /title #{ESCAPED_CANT} be blank/i
end
def test_get_edit
......@@ -166,7 +166,7 @@ class NewsControllerTest < ActionController::TestCase
put :update, :id => 1, :news => { :description => '' }
assert_response :success
assert_template 'edit'
assert_error_tag :content => /description #{ESCAPED_CANT} be blank/i
assert_select_error /description #{ESCAPED_CANT} be blank/i
end
def test_destroy
......
......@@ -51,7 +51,7 @@ class PreviewsControllerTest < ActionController::TestCase
assert_response :success
assert_template 'previews/issue'
assert_not_nil assigns(:notes)
assert_tag :p, :content => 'Foo'
assert_select 'p', :text => 'Foo'
end
def test_preview_issue_notes_should_support_links_to_existing_attachments
......@@ -77,8 +77,7 @@ class PreviewsControllerTest < ActionController::TestCase
:summary => ''}
assert_response :success
assert_template 'common/_preview'
assert_tag :tag => 'fieldset', :attributes => { :class => 'preview' },
:content => /News description/
assert_select 'fieldset.preview', :text => /News description/
end
def test_existing_new_news
......@@ -91,7 +90,6 @@ class PreviewsControllerTest < ActionController::TestCase
assert_equal News.find(2), assigns(:previewed)
assert_not_nil assigns(:attachments)
assert_tag :tag => 'fieldset', :attributes => { :class => 'preview' },
:content => /News description/
assert_select 'fieldset.preview', :text => /News description/
end
end
......@@ -422,7 +422,7 @@ class ProjectsControllerTest < ActionController::TestCase
post :update, :id => 1, :project => {:name => ''}
assert_response :success
assert_template 'settings'
assert_error_tag :content => /name #{ESCAPED_CANT} be blank/i
assert_select_error /name #{ESCAPED_CANT} be blank/i
end
def test_update_should_be_denied_for_member_on_closed_project
......
......@@ -36,10 +36,7 @@ class QueriesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'new'
assert_select 'input[name=?][value="0"][checked=checked]', 'query[visibility]'
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query_is_for_all',
:checked => nil,
:disabled => nil }
assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked]):not([disabled])'
assert_select 'select[name=?]', 'c[]' do
assert_select 'option[value=tracker]'
assert_select 'option[value=subject]'
......@@ -52,10 +49,7 @@ class QueriesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'new'
assert_select 'input[name=?]', 'query[visibility]', 0
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query_is_for_all',
:checked => 'checked',
:disabled => nil }
assert_select 'input[name=query_is_for_all][type=checkbox][checked]:not([disabled])'
end
def test_new_on_invalid_project
......@@ -198,10 +192,7 @@ class QueriesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'edit'
assert_select 'input[name=?][value="2"][checked=checked]', 'query[visibility]'
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query_is_for_all',
:checked => 'checked',
:disabled => 'disabled' }
assert_select 'input[name=query_is_for_all][type=checkbox][checked=checked][disabled=disabled]'
end
def test_edit_global_private_query
......@@ -210,10 +201,7 @@ class QueriesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'edit'
assert_select 'input[name=?]', 'query[visibility]', 0
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query_is_for_all',
:checked => 'checked',
:disabled => 'disabled' }
assert_select 'input[name=query_is_for_all][type=checkbox][checked=checked][disabled=disabled]'
end
def test_edit_project_private_query
......@@ -222,10 +210,7 @@ class QueriesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'edit'
assert_select 'input[name=?]', 'query[visibility]', 0
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query_is_for_all',
:checked => nil,
:disabled => nil }
assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked]):not([disabled])'
end
def test_edit_project_public_query
......@@ -234,10 +219,7 @@ class QueriesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'edit'
assert_select 'input[name=?][value="2"][checked=checked]', 'query[visibility]'
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
:name => 'query_is_for_all',
:checked => nil,
:disabled => 'disabled' }
assert_select 'input[name=query_is_for_all][type=checkbox][disabled=disabled]:not([checked])'
end
def test_edit_sort_criteria
......@@ -245,12 +227,10 @@ class QueriesControllerTest < ActionController::TestCase
get :edit, :id => 5
assert_response :success
assert_template 'edit'
assert_tag :tag => 'select', :attributes => { :name => 'query[sort_criteria][0][]' },
:child => { :tag => 'option', :attributes => { :value => 'priority',
:selected => 'selected' } }
assert_tag :tag => 'select', :attributes => { :name => 'query[sort_criteria][0][]' },
:child => { :tag => 'option', :attributes => { :value => 'desc',
:selected => 'selected' } }
assert_select 'select[name=?]', 'query[sort_criteria][0][]' do
assert_select 'option[value=priority][selected=selected]'
assert_select 'option[value=desc][selected=selected]'
end
end
def test_edit_invalid_query
......
......@@ -86,7 +86,7 @@ class RepositoriesBazaarControllerTest < ActionController::TestCase
:path => repository_path_hash(['doc-mkdir.txt'])[:param]
assert_response :success
assert_template 'changes'
assert_tag :tag => 'h2', :content => 'doc-mkdir.txt'
assert_select 'h2', :text => /doc-mkdir.txt/
end
def test_entry_show
......@@ -95,10 +95,7 @@ class RepositoriesBazaarControllerTest < ActionController::TestCase
assert_response :success
assert_template 'entry'
# Line 19
assert_tag :tag => 'th',
:content => /29/,
:attributes => { :class => /line-num/ },
:sibling => { :tag => 'td', :content => /Show help message/ }
assert_select 'tr#L29 td.line-code', :text => /Show help message/
end
def test_entry_download
......@@ -126,11 +123,7 @@ class RepositoriesBazaarControllerTest < ActionController::TestCase
assert_response :success
assert_template 'diff'
# Line 11 removed
assert_tag :tag => 'th',
:content => '11',
:sibling => { :tag => 'td',
:attributes => { :class => /diff_out/ },
:content => /Display more information/ }
assert_select 'th.line-num:content(11) ~ td.diff_out', :text => /Display more information/
end
end
......
......@@ -33,7 +33,7 @@ class RepositoriesControllerTest < ActionController::TestCase
assert_template 'new'
assert_kind_of Repository::Subversion, assigns(:repository)
assert assigns(:repository).new_record?
assert_tag 'input', :attributes => {:name => 'repository[url]', :disabled => nil}
assert_select 'input[name=?]:not([disabled])', 'repository[url]'
end
def test_new_should_propose_enabled_scm_only
......@@ -44,12 +44,12 @@ class RepositoriesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'new'
assert_kind_of Repository::Mercurial, assigns(:repository)
assert_tag 'select', :attributes => {:name => 'repository_scm'},
:children => {:count => 3}
assert_tag 'select', :attributes => {:name => 'repository_scm'},
:child => {:tag => 'option', :attributes => {:value => 'Mercurial', :selected => 'selected'}}
assert_tag 'select', :attributes => {:name => 'repository_scm'},
:child => {:tag => 'option', :attributes => {:value => 'Git', :selected => nil}}
assert_select 'select[name=repository_scm]' do
assert_select 'option', 3
assert_select 'option[value=Mercurial][selected=selected]'
assert_select 'option[value=Git]:not([selected])'
end
end
def test_create
......@@ -84,7 +84,7 @@ class RepositoriesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'edit'
assert_equal Repository.find(11), assigns(:repository)
assert_tag 'input', :attributes => {:name => 'repository[url]', :value => 'svn://localhost/test', :disabled => 'disabled'}
assert_select 'input[name=?][value=?][disabled=disabled]', 'repository[url]', 'svn://localhost/test'
end
def test_update
......@@ -170,20 +170,18 @@ class RepositoriesControllerTest < ActionController::TestCase
get :revision, :id => 1, :rev => 1
assert_response :success
assert_tag 'a', :attributes => {:href => '/projects/ecookbook/repository', :class => /repository/},
:ancestor => {:attributes => {:id => 'main-menu'}}
assert_select '#main-menu a.repository[href=?]', '/projects/ecookbook/repository'
end
def test_revision_with_before_nil_and_afer_normal
get :revision, {:id => 1, :rev => 1}
assert_response :success
assert_template 'revision'
assert_no_tag :tag => "div", :attributes => { :class => "contextual" },
:child => { :tag => "a", :attributes => { :href => '/projects/ecookbook/repository/revisions/0'}
}
assert_tag :tag => "div", :attributes => { :class => "contextual" },
:child => { :tag => "a", :attributes => { :href => '/projects/ecookbook/repository/revisions/2'}
}
assert_select 'div.contextual' do
assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/0', 0
assert_select 'a[href=?]', '/projects/ecookbook/repository/revisions/2'
end
end
def test_add_related_issue
......@@ -265,17 +263,14 @@ class RepositoriesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'committers'
assert_tag :td, :content => 'dlopper',
:sibling => { :tag => 'td',
:child => { :tag => 'select', :attributes => { :name => %r{^committers\[\d+\]\[\]$} },
:child => { :tag => 'option', :content => 'Dave Lopper',
:attributes => { :value => '3', :selected => 'selected' }}}}
assert_tag :td, :content => 'foo',
:sibling => { :tag => 'td',
:child => { :tag => 'select', :attributes => { :name => %r{^committers\[\d+\]\[\]$} }}}
assert_no_tag :td, :content => 'foo',
:sibling => { :tag => 'td',
:descendant => { :tag => 'option', :attributes => { :selected => 'selected' }}}
assert_select 'td:content(dlopper) + td select' do
assert_select 'option[value="3"][selected=selected]', :text => 'Dave Lopper'
end
assert_select 'td:content(foo) + td select' do
assert_select 'option[value=""]'
assert_select 'option[selected=selected]', 0 # no option selected
end
end
def test_post_committers
......
......@@ -112,9 +112,7 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]
assert_response :success
assert_template 'entry'
assert_no_tag :tag => 'td',
:attributes => { :class => /line-code/},
:content => /before_filter/
assert_select 'td.line-code', :text => /before_filter/, :count => 0
end
def test_entry_at_given_revision
......@@ -129,9 +127,7 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
assert_response :success
assert_template 'entry'
# this line was removed in r3
assert_tag :tag => 'td',
:attributes => { :class => /line-code/},
:content => /before_filter/
assert_select 'td.line-code', :text => /before_filter/
end
def test_entry_not_found
......@@ -141,9 +137,7 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
assert_equal NUM_REV, @repository.changesets.count
get :entry, :id => PRJ_ID,
:path => repository_path_hash(['sources', 'zzz.c'])[:param]
assert_tag :tag => 'p',
:attributes => { :id => /errorExplanation/ },
:content => /The entry or revision was not found in the repository/
assert_select 'p#errorExplanation', :text => /The entry or revision was not found in the repository/
end
def test_entry_download
......@@ -179,10 +173,8 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
get :diff, :id => PRJ_ID, :rev => 3, :type => dt
assert_response :success
assert_template 'diff'
assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_out' },
:content => /before_filter :require_login/
assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_in' },
:content => /with one change/
assert_select 'td.line-code.diff_out', :text => /before_filter :require_login/
assert_select 'td.line-code.diff_in', :text => /with one change/
end
end
......@@ -195,16 +187,11 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
get :diff, :id => PRJ_ID, :rev => 1, :type => dt
assert_response :success
assert_template 'diff'
assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_in' },
:content => /watched.remove_watcher/
assert_tag :tag => 'th', :attributes => { :class => 'filename' },
:content => /test\/README/
assert_tag :tag => 'th', :attributes => { :class => 'filename' },
:content => /test\/images\/delete.png/
assert_tag :tag => 'th', :attributes => { :class => 'filename' },
:content => /test\/images\/edit.png/
assert_tag :tag => 'th', :attributes => { :class => 'filename' },
:content => /test\/sources\/watchers_controller.rb/
assert_select 'td.line-code.diff_in', :text => /watched.remove_watcher/
assert_select 'th.filename', :text => /test\/README/
assert_select 'th.filename', :text => /test\/images\/delete.png/
assert_select 'th.filename', :text => /test\/images\/edit.png/
assert_select 'th.filename', :text => /test\/sources\/watchers_controller.rb/
end
end
......
......@@ -102,7 +102,7 @@ class RepositoriesDarcsControllerTest < ActionController::TestCase
:path => repository_path_hash(['images', 'edit.png'])[:param]
assert_response :success
assert_template 'changes'
assert_tag :tag => 'h2', :content => 'edit.png'
assert_select 'h2', :text => /edit.png/
end
def test_diff
......@@ -116,11 +116,7 @@ class RepositoriesDarcsControllerTest < ActionController::TestCase
assert_response :success
assert_template 'diff'
# Line 22 removed
assert_tag :tag => 'th',
:content => '22',
:sibling => { :tag => 'td',
:attributes => { :class => /diff_out/ },
:content => /def remove/ }
assert_select 'th.line-num:content(22) ~ td.diff_out', :text => /def remove/
end
end
......
......@@ -61,19 +61,16 @@ class RepositoriesFilesystemControllerTest < ActionController::TestCase
assert_not_nil assigns(:changesets)
assert assigns(:changesets).size == 0
assert_no_tag 'input', :attributes => {:name => 'rev'}
assert_no_tag 'a', :content => 'Statistics'
assert_no_tag 'a', :content => 'Atom'
assert_select 'input[name=rev]', 0
assert_select 'a', :text => 'Statistics', :count => 0
assert_select 'a', :text => 'Atom', :count => 0
end
def test_show_no_extension
get :entry, :id => PRJ_ID, :path => repository_path_hash(['test'])[:param]
assert_response :success
assert_template 'entry'
assert_tag :tag => 'th',
:content => '1',
:attributes => { :class => 'line-num' },
:sibling => { :tag => 'td', :content => /TEST CAT/ }
assert_select 'tr#L1 td.line-code', :text => /TEST CAT/
end
def test_entry_download_no_extension
......@@ -88,20 +85,14 @@ class RepositoriesFilesystemControllerTest < ActionController::TestCase
:path => repository_path_hash(['japanese', 'euc-jp.txt'])[:param]
assert_response :success
assert_template 'entry'
assert_tag :tag => 'th',
:content => '2',
:attributes => { :class => 'line-num' },
:sibling => { :tag => 'td', :content => /japanese/ }
assert_select 'tr#L2 td.line-code', :text => /japanese/
if @ruby19_non_utf8_pass
puts "TODO: show repository file contents test fails " +
"when Encoding.default_external is not UTF-8. " +
"Current value is '#{Encoding.default_external.to_s}'"
else
str_japanese = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e".force_encoding('UTF-8')
assert_tag :tag => 'th',
:content => '3',
:attributes => { :class => 'line-num' },
:sibling => { :tag => 'td', :content => /#{str_japanese}/ }
assert_select 'tr#L3 td.line-code', :text => /#{str_japanese}/
end
end
end
......@@ -112,10 +103,7 @@ class RepositoriesFilesystemControllerTest < ActionController::TestCase
get :entry, :id => PRJ_ID,
:path => repository_path_hash(['japanese', 'utf-16.txt'])[:param]
assert_response :success
assert_tag :tag => 'th',
:content => '2',
:attributes => { :class => 'line-num' },
:sibling => { :tag => 'td', :content => /japanese/ }
assert_select 'tr#L2 td.line-code', :text => /japanese/
end
end
......
......@@ -198,7 +198,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase
:path => repository_path_hash(['images', 'edit.png'])[:param]
assert_response :success
assert_template 'changes'
assert_tag :tag => 'h2', :content => 'edit.png'
assert_select 'h2', :text => /edit.png/
end
def test_entry_show
......@@ -206,11 +206,8 @@ class RepositoriesGitControllerTest < ActionController::TestCase
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param]