]> git.openstreetmap.org Git - rails.git/blob - test/helpers/title_helper_test.rb
Use correct title in og:title for pages with no title
[rails.git] / test / helpers / title_helper_test.rb
1 # coding: utf-8
2 require "test_helper"
3
4 class TitleHelperTest < ActionView::TestCase
5   def test_set_title
6     set_title
7     assert_equal "OpenStreetMap", response.header["X-Page-Title"]
8     assert_nil @title
9
10     set_title(nil)
11     assert_equal "OpenStreetMap", response.header["X-Page-Title"]
12     assert_nil @title
13
14     set_title("Test Title")
15     assert_equal "OpenStreetMap%20%7C%20Test%20Title", response.header["X-Page-Title"]
16     assert_equal "Test Title", @title
17
18     set_title("Test & Title")
19     assert_equal "OpenStreetMap%20%7C%20Test%20&%20Title", response.header["X-Page-Title"]
20     assert_equal "Test & Title", @title
21
22     set_title("Tést & Tïtlè")
23     assert_equal "OpenStreetMap%20%7C%20T%C3%A9st%20&%20T%C3%AFtl%C3%A8", response.header["X-Page-Title"]
24     assert_equal "Tést & Tïtlè", @title
25   end
26 end