Feature #39111 » 0003-Fix-tests.patch
| test/helpers/application_helper_test.rb | ||
|---|---|---|
| 2037 | 2037 |
end |
| 2038 | 2038 | |
| 2039 | 2039 |
def test_stylesheet_link_tag_should_pick_the_default_stylesheet |
| 2040 |
assert_match 'href="/stylesheets/styles.css"', stylesheet_link_tag("styles")
|
|
| 2040 |
assert_match 'href="/assets/styles.css"', stylesheet_link_tag("styles")
|
|
| 2041 | 2041 |
end |
| 2042 | 2042 | |
| 2043 | 2043 |
def test_stylesheet_link_tag_for_plugin_should_pick_the_plugin_stylesheet |
| 2044 |
assert_match 'href="/plugin_assets/foo/stylesheets/styles.css"',
|
|
| 2044 |
assert_match 'href="/assets/plugin_assets/foo/styles.css"',
|
|
| 2045 | 2045 |
stylesheet_link_tag("styles", :plugin => :foo)
|
| 2046 | 2046 |
end |
| 2047 | 2047 | |
| 2048 | 2048 |
def test_image_tag_should_pick_the_default_image |
| 2049 |
assert_match 'src="/images/image.png"', image_tag("image.png")
|
|
| 2049 |
assert_match 'src="/assets/image.png"', image_tag("image.png")
|
|
| 2050 | 2050 |
end |
| 2051 | 2051 | |
| 2052 | 2052 |
def test_image_tag_should_pick_the_theme_image_if_it_exists |
| ... | ... | |
| 2054 | 2054 |
theme.images << 'image.png' |
| 2055 | 2055 | |
| 2056 | 2056 |
with_settings :ui_theme => theme.id do |
| 2057 |
assert_match %|src="/themes/#{theme.dir}/images/image.png"|, image_tag("image.png")
|
|
| 2058 |
assert_match %|src="/images/other.png"|, image_tag("other.png")
|
|
| 2057 |
assert_match %|src="/assets/themes/#{theme.dir}/image.png"|, image_tag("image.png")
|
|
| 2058 |
assert_match %|src="/assets/other.png"|, image_tag("other.png")
|
|
| 2059 | 2059 |
end |
| 2060 | 2060 |
ensure |
| 2061 | 2061 |
theme.images.delete 'image.png' |
| 2062 | 2062 |
end |
| 2063 | 2063 | |
| 2064 | 2064 |
def test_image_tag_sfor_plugin_should_pick_the_plugin_image |
| 2065 |
assert_match 'src="/plugin_assets/foo/images/image.png"', image_tag("image.png", :plugin => :foo)
|
|
| 2065 |
assert_match 'src="/assets/plugin_assets/foo/image.png"', image_tag("image.png", :plugin => :foo)
|
|
| 2066 | 2066 |
end |
| 2067 | 2067 | |
| 2068 | 2068 |
def test_javascript_include_tag_should_pick_the_default_javascript |
| 2069 |
assert_match 'src="/javascripts/scripts.js"', javascript_include_tag("scripts")
|
|
| 2069 |
assert_match 'src="/assets/scripts.js"', javascript_include_tag("scripts")
|
|
| 2070 | 2070 |
end |
| 2071 | 2071 | |
| 2072 | 2072 |
def test_javascript_include_tag_for_plugin_should_pick_the_plugin_javascript |
| 2073 |
assert_match 'src="/plugin_assets/foo/javascripts/scripts.js"', javascript_include_tag("scripts", :plugin => :foo)
|
|
| 2073 |
assert_match 'src="/assets/plugin_assets/foo/scripts.js"', javascript_include_tag("scripts", :plugin => :foo)
|
|
| 2074 | 2074 |
end |
| 2075 | 2075 | |
| 2076 | 2076 |
def test_raw_json_should_escape_closing_tags |
| test/helpers/avatars_helper_test.rb | ||
|---|---|---|
| 39 | 39 |
end |
| 40 | 40 | |
| 41 | 41 |
def test_avatar_with_anonymous_user |
| 42 |
assert_match %r{src="/images/anonymous.png(\?\d+)?"}, avatar(User.anonymous)
|
|
| 42 |
assert_match %r{src="/assets/anonymous(-\w+)?.png"}, avatar(User.anonymous)
|
|
| 43 | 43 |
end |
| 44 | 44 | |
| 45 | 45 |
def test_avatar_with_group |
| 46 |
assert_match %r{src="/images/group.png(\?\d+)?"}, avatar(Group.first)
|
|
| 46 |
assert_match %r{src="/assets/group(-\w+)?.png"}, avatar(Group.first)
|
|
| 47 | 47 |
end |
| 48 | 48 | |
| 49 | 49 |
def test_avatar_with_invalid_arg_should_return_nil |
| test/integration/layout_test.rb | ||
|---|---|---|
| 65 | 65 |
Role.anonymous.add_permission! :add_issues |
| 66 | 66 | |
| 67 | 67 |
get '/projects/ecookbook/issues/new' |
| 68 |
assert_select 'head script[src^=?]', '/javascripts/jstoolbar/jstoolbar.js?'
|
|
| 68 |
assert_select "head script:match('src',?)", %r{/assets/jstoolbar/jstoolbar-\w+.js}
|
|
| 69 | 69 |
assert_include "var userHlLanguages = #{UserPreference::DEFAULT_TOOLBAR_LANGUAGE_OPTIONS.to_json};", response.body
|
| 70 | 70 |
end |
| 71 | 71 | |
| 72 | 72 |
def test_calendar_header_tags |
| 73 | 73 |
with_settings :default_language => 'fr' do |
| 74 | 74 |
get '/issues' |
| 75 |
assert_include "/javascripts/i18n/datepicker-fr.js", response.body
|
|
| 75 |
assert_match %r{/assets/i18n/datepicker-fr-\w+.js}, response.body
|
|
| 76 | 76 |
end |
| 77 | 77 | |
| 78 | 78 |
with_settings :default_language => 'en-GB' do |
| 79 | 79 |
get '/issues' |
| 80 |
assert_include "/javascripts/i18n/datepicker-en-GB.js", response.body
|
|
| 80 |
assert_match %r{/assets/i18n/datepicker-en-GB-\w+.js}, response.body
|
|
| 81 | 81 |
end |
| 82 | 82 | |
| 83 | 83 |
with_settings :default_language => 'en' do |
| 84 | 84 |
get '/issues' |
| 85 |
assert_not_include "/javascripts/i18n/datepicker", response.body
|
|
| 85 |
assert_not_include "/assets/i18n/datepicker", response.body
|
|
| 86 | 86 |
end |
| 87 | 87 | |
| 88 | 88 |
with_settings :default_language => 'es' do |
| 89 | 89 |
get '/issues' |
| 90 |
assert_include "/javascripts/i18n/datepicker-es.js", response.body
|
|
| 90 |
assert_match %r{/assets/i18n/datepicker-es-\w+.js}, response.body
|
|
| 91 | 91 |
end |
| 92 | 92 | |
| 93 | 93 |
with_settings :default_language => 'es-PA' do |
| ... | ... | |
| 99 | 99 | |
| 100 | 100 |
with_settings :default_language => 'zh' do |
| 101 | 101 |
get '/issues' |
| 102 |
assert_include "/javascripts/i18n/datepicker-zh-CN.js", response.body
|
|
| 102 |
assert_match %r{/assets/i18n/datepicker-zh-CN-\w+.js}, response.body
|
|
| 103 | 103 |
end |
| 104 | 104 | |
| 105 | 105 |
with_settings :default_language => 'zh-TW' do |
| 106 | 106 |
get '/issues' |
| 107 |
assert_include "/javascripts/i18n/datepicker-zh-TW.js", response.body
|
|
| 107 |
assert_match %r{/assets/i18n/datepicker-zh-TW-\w+.js}, response.body
|
|
| 108 | 108 |
end |
| 109 | 109 | |
| 110 | 110 |
with_settings :default_language => 'pt' do |
| 111 | 111 |
get '/issues' |
| 112 |
assert_include "/javascripts/i18n/datepicker-pt.js", response.body
|
|
| 112 |
assert_match %r{/assets/i18n/datepicker-pt-\w+.js}, response.body
|
|
| 113 | 113 |
end |
| 114 | 114 | |
| 115 | 115 |
with_settings :default_language => 'pt-BR' do |
| 116 | 116 |
get '/issues' |
| 117 |
assert_include "/javascripts/i18n/datepicker-pt-BR.js", response.body
|
|
| 117 |
assert_match %r{/assets/i18n/datepicker-pt-BR-\w+.js}, response.body
|
|
| 118 | 118 |
end |
| 119 | 119 |
end |
| 120 | 120 | |
| test/integration/lib/redmine/hook_test.rb | ||
|---|---|---|
| 78 | 78 |
Redmine::Hook.add_listener(ProjectBasedTemplate) |
| 79 | 79 | |
| 80 | 80 |
get '/projects/ecookbook' |
| 81 |
assert_select 'head link[href=?]', '/stylesheets/ecookbook.css'
|
|
| 81 |
assert_select 'head link[href=?]', '/assets/ecookbook.css'
|
|
| 82 | 82 |
end |
| 83 | 83 | |
| 84 | 84 |
def test_empty_sidebar_should_be_hidden |
| test/integration/lib/redmine/themes_test.rb | ||
|---|---|---|
| 35 | 35 |
get '/' |
| 36 | 36 | |
| 37 | 37 |
assert_response :success |
| 38 |
assert_select "link[rel=stylesheet][href^=?]", "/themes/#{@theme.dir}/stylesheets/application.css"
|
|
| 38 |
assert_select "link[rel=stylesheet]:match('href', ?)", %r{/assets/themes/#{@theme.dir}/application-\w+\.css}
|
|
| 39 | 39 |
end |
| 40 | 40 | |
| 41 | 41 |
def test_without_theme_js |
| ... | ... | |
| 44 | 44 |
get '/' |
| 45 | 45 | |
| 46 | 46 |
assert_response :success |
| 47 |
assert_select "script[src^=?]", "/themes/#{@theme.dir}/javascripts/theme.js", 0
|
|
| 47 |
assert_select "script[src^=?]", "/assets/themes/#{@theme.dir}/theme.js", 0
|
|
| 48 | 48 |
end |
| 49 | 49 | |
| 50 | 50 |
def test_with_theme_js |
| ... | ... | |
| 53 | 53 |
get '/' |
| 54 | 54 | |
| 55 | 55 |
assert_response :success |
| 56 |
assert_select "script[src^=?]", "/themes/#{@theme.dir}/javascripts/theme.js", 1
|
|
| 56 |
assert_select "script[src^=?]", "/assets/themes/#{@theme.dir}/theme.js", 1
|
|
| 57 | 57 |
ensure |
| 58 | 58 |
@theme.javascripts.delete 'theme' |
| 59 | 59 |
end |
| ... | ... | |
| 72 | 72 |
get '/' |
| 73 | 73 | |
| 74 | 74 |
assert_response :success |
| 75 |
assert_select 'link[rel="shortcut icon"][href^=?]', "/themes/#{@theme.dir}/favicon/a.ico"
|
|
| 75 |
assert_select 'link[rel="shortcut icon"][href^=?]', "/assets/themes/#{@theme.dir}/a.ico"
|
|
| 76 | 76 |
ensure |
| 77 | 77 |
@theme.favicons.delete 'a.ico' |
| 78 | 78 |
end |
| ... | ... | |
| 83 | 83 | |
| 84 | 84 |
assert_response :success |
| 85 | 85 |
assert_select 'link[rel="shortcut icon"]', 1 |
| 86 |
assert_select 'link[rel="shortcut icon"][href^=?]', "/themes/#{@theme.dir}/favicon/b.ico"
|
|
| 86 |
assert_select 'link[rel="shortcut icon"][href^=?]', "/assets/themes/#{@theme.dir}/b.ico"
|
|
| 87 | 87 |
ensure |
| 88 | 88 |
@theme.favicons.delete("b.ico")
|
| 89 | 89 |
@theme.favicons.delete("a.png")
|
| ... | ... | |
| 96 | 96 |
get '/' |
| 97 | 97 | |
| 98 | 98 |
assert_response :success |
| 99 |
assert_select "link[rel=stylesheet][href^=?]", "/foo/themes/#{@theme.dir}/stylesheets/application.css"
|
|
| 100 |
assert_select "script[src^=?]", "/foo/themes/#{@theme.dir}/javascripts/theme.js"
|
|
| 101 |
assert_select 'link[rel="shortcut icon"][href^=?]', "/foo/themes/#{@theme.dir}/favicon/a.ico"
|
|
| 99 |
assert_select "link[rel=stylesheet]:match('href', ?)", %r{/foo/assets/themes/#{@theme.dir}/application-\w+\.css}
|
|
| 100 |
assert_select "script[src^=?]", "/foo/assets/themes/#{@theme.dir}/theme.js"
|
|
| 101 |
assert_select 'link[rel="shortcut icon"][href^=?]', "/foo/assets/themes/#{@theme.dir}/a.ico"
|
|
| 102 | 102 |
ensure |
| 103 | 103 |
Redmine::Utils.relative_url_root = '' |
| 104 | 104 |
end |
| test/test_helper.rb | ||
|---|---|---|
| 329 | 329 | |
| 330 | 330 |
class HelperTest < ActionView::TestCase |
| 331 | 331 |
include Redmine::I18n |
| 332 |
include Propshaft::Helper |
|
| 332 | 333 | |
| 333 | 334 |
def setup |
| 334 | 335 |
super |