Class: CreatesHtmlFileTest

Inherits:
Object
  • Object
show all
Defined in:
lib/creates_html_file_test.rb

Class Method Summary collapse

Class Method Details

.creates_html_file_test(content = nil, title_arg = "my page", arg = "index", bypass_html: false) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/creates_html_file_test.rb', line 4

def self.creates_html_file_test(content=nil, title_arg="my page", arg="index", bypass_html: false)

  content = Sanitize.fragment(content) unless bypass_html

  html_temp = %[
    <!DOCTYPE html>
    <html lang="">
      <head>
          <meta charset="utf-8">
          <title>#{title_arg}</title>
      </head>
      <body>
        <header></header>
        <main> 
          #{content}
        </main>
        <footer></footer>
        </body>
    </html>]

  system "echo '#{html_temp}' > #{arg}.html"
end