Module: ScrewUnit::Resources::Spec

Included in:
JsTestCore::Resources::Specs::SpecDir, JsTestCore::Resources::Specs::SpecFile
Defined in:
lib/screw_unit/resources/spec.rb

Instance Method Summary collapse

Instance Method Details

#get(request, response) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/screw_unit/resources/spec.rb', line 4

def get(request, response)
  html = <<-HTML
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko">
  <head>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  <title>ScrewUnit results</title>
  <script src="/core/jquery-1.2.3.js"></script>
  <script src="/core/jquery.fn.js"></script>
  <script src="/core/jquery.print.js"></script>
  <script src="/core/screw.builder.js"></script>
  <script src="/core/screw.matchers.js"></script>
  <script src="/core/screw.events.js"></script>
  <script src="/core/screw.behaviors.js"></script>
  <script src="/core/screw.assets.js"></script>
  <script src="/core/screw.server.js"></script>
  <link rel="stylesheet" href="/core/screw.css">
  HTML
  spec_files.each do |file|
    html << %{<script type="text/javascript" src="#{file.relative_path}"></script>\n}
  end

  html << <<-HTML
  </head>
  <body>
  <div id="screw_unit_content"></div>
  </body>
  </html>
  HTML
  response.body = html.gsub(/^        /, "")
end