You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

help_controller_test.rb 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # frozen_string_literal: true
  2. # Redmine - project management software
  3. # Copyright (C) 2006- Jean-Philippe Lang
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License
  7. # as published by the Free Software Foundation; either version 2
  8. # of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. require_relative '../test_helper'
  19. class HelpControllerTest < Redmine::ControllerTest
  20. fixtures :users, :email_addresses
  21. def test_get_help_wiki_syntax
  22. formatters = {
  23. :textile => "Wiki Syntax Quick Reference",
  24. :markdown => "Wiki Syntax Quick Reference (Markdown)",
  25. :common_mark => "Wiki Syntax Quick Reference (CommonMark Markdown (GitHub Flavored))"
  26. }
  27. formatters.each do |formatter, result|
  28. with_settings :text_formatting => formatter do
  29. get :show_wiki_syntax
  30. assert_response :success
  31. assert_select 'h1', :text => result
  32. end
  33. end
  34. end
  35. def test_get_help_wiki_syntax_detailed
  36. formatters = {
  37. :textile => "Wiki formatting",
  38. :markdown => "Wiki formatting (Markdown)",
  39. :common_mark => "Wiki formatting (CommonMark Markdown (GitHub Flavored))"
  40. }
  41. formatters.each do |formatter, result|
  42. with_settings :text_formatting => formatter do
  43. get :show_wiki_syntax, :params => {
  44. :type => 'detailed'
  45. }
  46. assert_response :success
  47. assert_select 'h1', :text => result
  48. end
  49. end
  50. end
  51. def test_get_help_wiki_syntax_should_return_lang_if_available
  52. user = User.find(2)
  53. user.language = 'de'
  54. user.save!
  55. @request.session[:user_id] = 2
  56. get :show_wiki_syntax
  57. assert_response :success
  58. assert_select 'h1', :text => "Wiki Syntax Schnellreferenz (CommonMark Markdown (GitHub Flavored))"
  59. end
  60. def test_get_help_wiki_syntax_should_fallback_to_english
  61. user = User.find(2)
  62. user.language = 'ro'
  63. user.save!
  64. @request.session[:user_id] = 2
  65. get :show_wiki_syntax
  66. assert_response :success
  67. assert_select 'h1', :text => "Wiki Syntax Quick Reference (CommonMark Markdown (GitHub Flavored))"
  68. end
  69. def test_get_help_code_highlighting
  70. get :show_code_highlighting
  71. assert_response :success
  72. assert_select 'h1', :text => "List of languages supported by Redmine code highlighter"
  73. end
  74. end