Class: ScrewUnit::Representations::Spec

Inherits:
JsTestCore::Representations::Spec
  • Object
show all
Defined in:
lib/screw_unit/representations/spec.html.rb

Instance Method Summary collapse

Instance Method Details

#body_contentObject



112
113
114
# File 'lib/screw_unit/representations/spec.html.rb', line 112

def body_content
  div :id => "screw_unit_content"
end

#core_js_filesObject



92
93
94
95
96
97
98
99
100
# File 'lib/screw_unit/representations/spec.html.rb', line 92

def core_js_files
  script :src => jquery_js_file
  script :src => "/core/jquery.fn.js"
  script :src => "/core/jquery.print.js"
  script :src => "/core/screw.builder.js"
  script :src => "/core/screw.matchers.js"
  script :src => "/core/screw.events.js"
  script :src => "/core/screw.behaviors.js"
end

#head_contentObject



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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/screw_unit/representations/spec.html.rb', line 8

def head_content
  core_js_files
  script(raw("    (function($) {\n      Screw.Assets = {};\n      Screw.Assets.use_cache_buster = false; // TODO: NS/CTI - make this configurable from the UI.\n      var required_paths = [];\n      var included_stylesheets = {};\n      var cache_buster = parseInt(new Date().getTime()/(1*1000));\n\n      function tag(name, attributes) {\n        var html = \"<\" + name;\n        for(var attribute in attributes) {\n          html += (\" \" + attribute + \"='\" + attributes[attribute]) + \"'\";\n        };\n        html += \"></\";\n        html += name;\n        html += \">\";\n        return html;\n      }\n\n      Screw.Assets.require = function(javascript_path, onload) {\n        if(!required_paths[javascript_path]) {\n          var full_path = javascript_path + \".js\";\n          if (Screw.Assets.use_cache_buster) {\n            full_path += '?' + cache_buster;\n          }\n          document.write(tag(\"script\", {src: full_path, type: 'text/javascript'}));\n          if(onload) {\n            var scripts = document.getElementsByTagName('script');\n            scripts[scripts.length-1].onload = onload;\n          }\n          required_paths[javascript_path] = true;\n        }\n      };\n\n      Screw.Assets.stylesheet = function(stylesheet_path) {\n        if(!included_stylesheets[stylesheet_path]) {\n          var full_path = stylesheet_path + \".css\";\n          if(Screw.Assets.use_cache_buster) {\n            full_path += '?' + cache_buster;\n          }\n          document.write(tag(\"link\", {rel: 'stylesheet', type: 'text/css', href: full_path}));\n          included_stylesheets[stylesheet_path] = true;\n        }\n      };\n\n      window.require = Screw.Assets.require;\n      window.stylesheet = Screw.Assets.stylesheet;\n    })(jQuery);\n\n    (function($) {\n      var ajax = $.ajax;\n      $(Screw).bind('after', function() {\n        var error_text = $(\".error\").map(function(i, error_element) {\n          var element = $(error_element);\n\n          var parent_descriptions = element.parents(\"li.describe\");\n          var parent_description_text = [];\n\n          for(var i=parent_descriptions.length-1; i >= 0; i--) {\n            parent_description_text.push($(parent_descriptions[i]).find(\"h1\").text());\n          }\n\n          var it_text = element.parents(\"li.it\").find(\"h2\").text();\n\n          return parent_description_text.join(\" \") + \" \" + it_text + \": \" + element.text();\n        }).get().join(\"\\\\n\");\n\n        ajax({\n          type: \"POST\",\n          url: '\#{ScrewUnit::Resources::SeleniumSession.path(\"/finish\")}',\n          data: {\"text\": error_text}\n        });\n      });\n    })(jQuery);\n  JS\n  project_js_files\n  link :rel => \"stylesheet\", :href => \"/core/screw.css\"\n  project_css_files\n\n  spec_script_elements\nend\n"), :type => "text/javascript")

#jquery_js_fileObject



108
109
110
# File 'lib/screw_unit/representations/spec.html.rb', line 108

def jquery_js_file
  "/core/jquery-1.3.2.js"
end

#project_css_filesObject



105
106
# File 'lib/screw_unit/representations/spec.html.rb', line 105

def project_css_files
end

#project_js_filesObject



102
103
# File 'lib/screw_unit/representations/spec.html.rb', line 102

def project_js_files
end

#title_textObject



4
5
6
# File 'lib/screw_unit/representations/spec.html.rb', line 4

def title_text
  "Screw Unit suite"
end