Use #assert_select instead of #assert_tag.

git-svn-id: http://svn.redmine.org/redmine/trunk@12647 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2014-01-11 11:26:53 +00:00
parent 8b999962de
commit fa52c5d9fc
1 changed files with 5 additions and 11 deletions

View File

@ -32,16 +32,14 @@ class ThemesTest < ActionController::IntegrationTest
get '/' get '/'
assert_response :success assert_response :success
assert_tag :tag => 'link', assert_select "link[href^=/themes/#{@theme.dir}/stylesheets/application.css]"
:attributes => {:href => %r{^/themes/#{@theme.dir}/stylesheets/application.css}}
end end
def test_without_theme_js def test_without_theme_js
get '/' get '/'
assert_response :success assert_response :success
assert_no_tag :tag => 'script', assert_select "script[src^=/themes/#{@theme.dir}/javascripts/theme.js]", 0
:attributes => {:src => %r{^/themes/#{@theme.dir}/javascripts/theme.js}}
end end
def test_with_theme_js def test_with_theme_js
@ -50,9 +48,7 @@ class ThemesTest < ActionController::IntegrationTest
get '/' get '/'
assert_response :success assert_response :success
assert_tag :tag => 'script', assert_select "script[src^=/themes/#{@theme.dir}/javascripts/theme.js]", 1
:attributes => {:src => %r{^/themes/#{@theme.dir}/javascripts/theme.js}}
ensure ensure
@theme.javascripts.delete 'theme' @theme.javascripts.delete 'theme'
end end
@ -94,10 +90,8 @@ class ThemesTest < ActionController::IntegrationTest
get '/' get '/'
assert_response :success assert_response :success
assert_tag :tag => 'link', assert_select "link[href^=/foo/themes/#{@theme.dir}/stylesheets/application.css]"
:attributes => {:href => %r{^/foo/themes/#{@theme.dir}/stylesheets/application.css}} assert_select "script[src^=/foo/themes/#{@theme.dir}/javascripts/theme.js]"
assert_tag :tag => 'script',
:attributes => {:src => %r{^/foo/themes/#{@theme.dir}/javascripts/theme.js}}
assert_select "link[rel=shortcut icon][href^=/foo/themes/#{@theme.dir}/favicon/a.ico]" assert_select "link[rel=shortcut icon][href^=/foo/themes/#{@theme.dir}/favicon/a.ico]"
ensure ensure
Redmine::Utils.relative_url_root = '' Redmine::Utils.relative_url_root = ''