@@ -322,6 +322,51 @@ def test_title_escape
322322 assert_main_title ( File . binread ( 'index.html' ) , title )
323323 end
324324
325+ def test_meta_tags_for_index
326+ @options . title = "My awesome Ruby project"
327+ @g . generate
328+
329+ content = File . binread ( "index.html" )
330+
331+ assert_include ( content , '<meta name="keywords" content="ruby,documentation,My awesome Ruby project">' )
332+ assert_include ( content , '<meta name="description" content="Documentation for My awesome Ruby project">' )
333+ end
334+
335+ def test_meta_tags_for_classes
336+ top_level = @store . add_file ( "file.rb" )
337+ top_level . add_class ( @klass . class , @klass . name )
338+ inner = @klass . add_class ( RDoc ::NormalClass , "Inner" )
339+ inner . add_comment ( "This is a normal class. It is fully documented." , top_level )
340+
341+ @g . generate
342+
343+ content = File . binread ( "Klass/Inner.html" )
344+ assert_include ( content , '<meta name="keywords" content="ruby,class,Klass::Inner">' )
345+ assert_include (
346+ content ,
347+ '<meta name="description" content="class Klass::Inner: This is a normal class. It is fully documented.">' ,
348+ )
349+ end
350+
351+ def test_meta_tags_for_pages
352+ top_level = @store . add_file ( "CONTRIBUTING.rdoc" , parser : RDoc ::Parser ::Simple )
353+ top_level . comment = <<~RDOC
354+ = Contributing
355+
356+ Here are the instructions for contributing. Begin by installing Ruby.
357+ RDOC
358+
359+ @g . generate
360+
361+ content = File . binread ( "CONTRIBUTING_rdoc.html" )
362+ assert_include ( content , '<meta name="keywords" content="ruby,documentation,CONTRIBUTING">' )
363+ assert_include (
364+ content ,
365+ "<meta name=\" description\" content=\" CONTRIBUTING: Contributing Here are the instructions for contributing." \
366+ " Begin by installing Ruby.\" >" ,
367+ )
368+ end
369+
325370 ##
326371 # Asserts that +filename+ has a link count greater than 1 if hard links to
327372 # @tmpdir are supported.
0 commit comments