teaspoon 0.7.9 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +382 -260
  3. data/app/assets/javascripts/teaspoon-angular.js +108 -26241
  4. data/app/assets/javascripts/teaspoon-jasmine.js +103 -2642
  5. data/app/assets/javascripts/teaspoon-mocha.js +109 -5416
  6. data/app/assets/javascripts/teaspoon-qunit.js +107 -2255
  7. data/app/assets/javascripts/teaspoon-teaspoon.js +0 -1
  8. data/app/assets/javascripts/teaspoon/angular.coffee +3 -1
  9. data/app/assets/javascripts/teaspoon/base/hook.coffee +21 -0
  10. data/app/assets/javascripts/teaspoon/base/reporters/html.coffee +26 -14
  11. data/app/assets/javascripts/teaspoon/base/reporters/html/progress_view.coffee +1 -1
  12. data/app/assets/javascripts/teaspoon/base/reporters/html/template.coffee +3 -3
  13. data/app/assets/javascripts/teaspoon/base/teaspoon.coffee +10 -1
  14. data/app/assets/javascripts/teaspoon/jasmine.coffee +3 -1
  15. data/app/assets/javascripts/teaspoon/mocha.coffee +3 -1
  16. data/app/assets/javascripts/teaspoon/mocha/reporters/html.coffee +1 -1
  17. data/app/assets/javascripts/teaspoon/qunit.coffee +3 -1
  18. data/app/assets/javascripts/teaspoon/qunit/reporters/html.coffee +1 -1
  19. data/app/assets/javascripts/teaspoon/teaspoon.coffee +0 -1
  20. data/app/assets/stylesheets/teaspoon.css +12 -8
  21. data/app/controllers/teaspoon/suite_controller.rb +32 -0
  22. data/app/views/teaspoon/suite/_body.html.erb +0 -0
  23. data/app/views/teaspoon/suite/_boot.html.erb +4 -0
  24. data/app/views/teaspoon/suite/_boot_require_js.html.erb +19 -0
  25. data/app/views/teaspoon/{spec/suites.html.erb → suite/index.html.erb} +6 -7
  26. data/app/views/teaspoon/suite/show.html.erb +19 -0
  27. data/bin/teaspoon +1 -1
  28. data/config/routes.rb +14 -4
  29. data/lib/generators/teaspoon/install/POST_INSTALL +2 -2
  30. data/lib/generators/teaspoon/install/install_generator.rb +22 -11
  31. data/lib/generators/teaspoon/install/templates/_body.html.erb +0 -0
  32. data/lib/generators/teaspoon/install/templates/_boot.html.erb +4 -0
  33. data/lib/generators/teaspoon/install/templates/jasmine/env.rb +11 -0
  34. data/lib/generators/teaspoon/install/templates/jasmine/env_comments.rb +182 -0
  35. data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +8 -6
  36. data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +8 -7
  37. data/lib/generators/teaspoon/install/templates/mocha/env.rb +11 -0
  38. data/lib/generators/teaspoon/install/templates/mocha/env_comments.rb +182 -0
  39. data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +13 -13
  40. data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +13 -13
  41. data/lib/generators/teaspoon/install/templates/qunit/env.rb +11 -0
  42. data/lib/generators/teaspoon/install/templates/qunit/env_comments.rb +182 -0
  43. data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +6 -5
  44. data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +6 -5
  45. data/lib/tasks/teaspoon.rake +9 -2
  46. data/lib/teaspoon.rb +4 -6
  47. data/lib/teaspoon/command_line.rb +116 -134
  48. data/lib/teaspoon/configuration.rb +144 -66
  49. data/lib/teaspoon/console.rb +70 -37
  50. data/lib/teaspoon/coverage.rb +42 -15
  51. data/lib/teaspoon/deprecated.rb +65 -0
  52. data/lib/teaspoon/drivers/base.rb +10 -0
  53. data/lib/teaspoon/drivers/phantomjs/runner.js +9 -11
  54. data/lib/teaspoon/drivers/phantomjs_driver.rb +21 -21
  55. data/lib/teaspoon/drivers/selenium_driver.rb +32 -13
  56. data/lib/teaspoon/engine.rb +32 -12
  57. data/lib/teaspoon/environment.rb +16 -12
  58. data/lib/teaspoon/exceptions.rb +41 -5
  59. data/lib/teaspoon/exporter.rb +52 -0
  60. data/lib/teaspoon/formatters/base.rb +171 -0
  61. data/lib/teaspoon/formatters/clean_formatter.rb +2 -4
  62. data/lib/teaspoon/formatters/documentation_formatter.rb +60 -0
  63. data/lib/teaspoon/formatters/dot_formatter.rb +12 -90
  64. data/lib/teaspoon/formatters/json_formatter.rb +36 -0
  65. data/lib/teaspoon/formatters/junit_formatter.rb +51 -32
  66. data/lib/teaspoon/formatters/modules/report_module.rb +76 -0
  67. data/lib/teaspoon/formatters/pride_formatter.rb +23 -27
  68. data/lib/teaspoon/formatters/snowday_formatter.rb +7 -11
  69. data/lib/teaspoon/formatters/swayze_or_oprah_formatter.rb +88 -64
  70. data/lib/teaspoon/formatters/tap_formatter.rb +18 -27
  71. data/lib/teaspoon/formatters/tap_y_formatter.rb +35 -45
  72. data/lib/teaspoon/formatters/teamcity_formatter.rb +69 -31
  73. data/lib/teaspoon/instrumentation.rb +33 -33
  74. data/lib/teaspoon/result.rb +2 -1
  75. data/lib/teaspoon/runner.rb +40 -28
  76. data/lib/teaspoon/server.rb +23 -25
  77. data/lib/teaspoon/suite.rb +52 -72
  78. data/lib/teaspoon/utility.rb +3 -14
  79. data/lib/teaspoon/version.rb +1 -1
  80. data/spec/dummy/app/assets/javascripts/integration/integration_spec.coffee +3 -0
  81. data/spec/dummy/app/assets/javascripts/integration/spec_helper.coffee +2 -0
  82. data/spec/dummy/config/application.rb +3 -0
  83. data/spec/features/console_reporter_spec.rb +48 -18
  84. data/spec/features/hooks_spec.rb +23 -41
  85. data/spec/features/html_reporter_spec.rb +38 -21
  86. data/spec/features/install_generator_spec.rb +34 -20
  87. data/spec/features/instrumentation_spec.rb +3 -2
  88. data/spec/fixtures/coverage.json +243 -0
  89. data/spec/javascripts/fixtures/_body.html.erb +1 -0
  90. data/spec/javascripts/jasmine_helper.coffee +1 -1
  91. data/spec/javascripts/teaspoon/base/fixture_spec.coffee +4 -4
  92. data/spec/javascripts/teaspoon/base/reporters/html_spec.coffee +9 -10
  93. data/spec/javascripts/teaspoon/mocha/reporters/html_mspec.coffee +0 -6
  94. data/spec/javascripts/teaspoon/phantomjs/runner_spec.coffee +5 -6
  95. data/spec/javascripts/turbolinks_helper.coffee +1 -1
  96. data/spec/spec_helper.rb +3 -4
  97. data/spec/teaspoon/command_line_spec.rb +139 -23
  98. data/spec/teaspoon/configuration_spec.rb +164 -46
  99. data/spec/teaspoon/console_spec.rb +142 -47
  100. data/spec/teaspoon/coverage_spec.rb +98 -28
  101. data/spec/teaspoon/drivers/base_spec.rb +5 -0
  102. data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +32 -14
  103. data/spec/teaspoon/drivers/selenium_driver_spec.rb +32 -24
  104. data/spec/teaspoon/engine_spec.rb +8 -5
  105. data/spec/teaspoon/environment_spec.rb +56 -33
  106. data/spec/teaspoon/exceptions_spec.rb +57 -0
  107. data/spec/teaspoon/exporter_spec.rb +96 -0
  108. data/spec/teaspoon/formatters/base_spec.rb +259 -0
  109. data/spec/teaspoon/formatters/clean_formatter_spec.rb +37 -0
  110. data/spec/teaspoon/formatters/documentation_formatter_spec.rb +127 -0
  111. data/spec/teaspoon/formatters/dot_formatter_spec.rb +52 -56
  112. data/spec/teaspoon/formatters/json_formatter_spec.rb +77 -0
  113. data/spec/teaspoon/formatters/junit_formatter_spec.rb +72 -35
  114. data/spec/teaspoon/formatters/pride_formatter_spec.rb +37 -0
  115. data/spec/teaspoon/formatters/snowday_formatter_spec.rb +35 -0
  116. data/spec/teaspoon/formatters/tap_formatter_spec.rb +29 -81
  117. data/spec/teaspoon/formatters/tap_y_formatter_spec.rb +31 -141
  118. data/spec/teaspoon/formatters/teamcity_formatter_spec.rb +99 -42
  119. data/spec/teaspoon/instrumentation_spec.rb +44 -44
  120. data/spec/teaspoon/result_spec.rb +37 -0
  121. data/spec/teaspoon/runner_spec.rb +70 -59
  122. data/spec/teaspoon/server_spec.rb +34 -52
  123. data/spec/teaspoon/suite_spec.rb +42 -188
  124. data/spec/teaspoon_env.rb +39 -28
  125. data/vendor/assets/javascripts/{angular-scenario-1.0.5.js → angular/1.0.5.js} +0 -0
  126. data/vendor/assets/javascripts/{angular-scenario-1.0.5.MIT-LICENSE → angular/MIT-LICENSE} +0 -0
  127. data/vendor/assets/javascripts/{jasmine-1.3.1.js → jasmine/1.3.1.js} +0 -0
  128. data/vendor/assets/javascripts/jasmine/2.0.0.js +2412 -0
  129. data/vendor/assets/javascripts/{jasmine-1.3.1.MIT.LICENSE → jasmine/MIT.LICENSE} +0 -0
  130. data/vendor/assets/javascripts/{mocha-1.10.0.js → mocha/1.10.0.js} +1 -0
  131. data/vendor/assets/javascripts/mocha/1.17.1.js +5813 -0
  132. data/vendor/assets/javascripts/{mocha-1.10.1.MIT.LICENSE → mocha/MIT.LICENSE} +0 -0
  133. data/vendor/assets/javascripts/{qunit-1.12.0.js → qunit/1.12.0.js} +1 -1
  134. data/vendor/assets/javascripts/qunit/1.14.0.js +2288 -0
  135. data/vendor/assets/javascripts/{qunit-1.12.0.MIT.LICENSE → qunit/MIT.LICENSE} +0 -0
  136. data/vendor/assets/javascripts/support/chai.js +827 -385
  137. data/vendor/assets/javascripts/support/jasmine-jquery-1.7.0.js +720 -0
  138. data/vendor/assets/javascripts/support/jasmine-jquery-2.0.0.js +812 -0
  139. data/vendor/assets/javascripts/support/sinon-chai.js +17 -0
  140. data/vendor/assets/javascripts/support/sinon.js +1138 -643
  141. metadata +57 -36
  142. data/app/controllers/teaspoon/spec_controller.rb +0 -38
  143. data/app/helpers/teaspoon/spec_helper.rb +0 -36
  144. data/app/views/teaspoon/spec/_require_js.html.erb +0 -21
  145. data/app/views/teaspoon/spec/_standard.html.erb +0 -4
  146. data/app/views/teaspoon/spec/runner.html.erb +0 -19
  147. data/lib/generators/teaspoon/install/templates/env.rb +0 -38
  148. data/lib/generators/teaspoon/install/templates/jasmine/initializer.rb +0 -64
  149. data/lib/generators/teaspoon/install/templates/mocha/initializer.rb +0 -64
  150. data/lib/generators/teaspoon/install/templates/qunit/initializer.rb +0 -64
  151. data/lib/teaspoon/check_coverage.rb +0 -33
  152. data/lib/teaspoon/drivers/base_driver.rb +0 -10
  153. data/lib/teaspoon/exception_handling.rb +0 -18
  154. data/lib/teaspoon/formatters/base_formatter.rb +0 -63
  155. data/spec/dummy/config/initializers/teaspoon.rb +0 -41
  156. data/spec/teaspoon/check_coverage_spec.rb +0 -50
  157. data/spec/teaspoon/formatters/base_formatter_spec.rb +0 -45
  158. data/vendor/assets/javascripts/support/chai.MIT.LICENSE +0 -22
  159. data/vendor/assets/javascripts/support/expect.MIT.LICENSE +0 -22
  160. data/vendor/assets/javascripts/support/jasmine-jquery.MIT.LICENSE +0 -20
  161. data/vendor/assets/javascripts/support/jasmine-jquery.js +0 -659
  162. data/vendor/assets/javascripts/support/sinon-chai.MIT-ISH.LICENSE +0 -13
  163. data/vendor/assets/javascripts/support/sinon.BSD.LICENSE +0 -27
@@ -9,7 +9,6 @@
9
9
  this.input = $u("#teaspoon-filter-input")[0];
10
10
  this.input.value = "";
11
11
  this.input.onkeyup = this.filter;
12
- this.input.focus();
13
12
  }
14
13
 
15
14
  TeaspoonInterface.prototype.filter = function() {
@@ -1,8 +1,10 @@
1
- #= require angular-scenario-1.0.5
2
1
  #= require teaspoon/base/teaspoon
3
2
  #= require teaspoon/angular/reporters/console
4
3
  #= require teaspoon/angular/reporters/html
5
4
 
5
+ unless angular?.scenario
6
+ throw new Teaspoon.Error('Angular Scenario not found -- use `suite.use_framework :angular` and adjust or remove the `suite.javascripts` directive.')
7
+
6
8
  class Teaspoon.Runner extends Teaspoon.Runner
7
9
 
8
10
  setup: ->
@@ -0,0 +1,21 @@
1
+ Teaspoon.hook = (name, options = {}) ->
2
+
3
+ xhr = null
4
+
5
+ xhrRequest = (url, options, callback) ->
6
+ if window.XMLHttpRequest # Mozilla, Safari, ...
7
+ xhr = new XMLHttpRequest()
8
+ else if window.ActiveXObject # IE
9
+ try xhr = new ActiveXObject("Msxml2.XMLHTTP")
10
+ catch e
11
+ try xhr = new ActiveXObject("Microsoft.XMLHTTP")
12
+ catch e
13
+ throw("Unable to make Ajax Request") unless xhr
14
+
15
+ xhr.onreadystatechange = callback
16
+ xhr.open(options['method'] || "GET", "#{Teaspoon.root}/#{url}", false)
17
+ xhr.send(options['payload'])
18
+
19
+ xhrRequest "#{Teaspoon.suites.active}/#{name}", options, ->
20
+ return unless xhr.readyState == 4
21
+ throw("Unable to call hook \"#{url}\".") unless xhr.status == 200
@@ -29,8 +29,6 @@ class Teaspoon.Reporters.HTML extends Teaspoon.Reporters.BaseView
29
29
  @findEl("suites").innerHTML = @buildSuiteSelect()
30
30
  @findEl("suite-select")?.onchange = @changeSuite
31
31
 
32
- @findEl("root-link").href = Teaspoon.root
33
-
34
32
  @el = @findEl("report-all")
35
33
 
36
34
  @showConfiguration()
@@ -41,15 +39,19 @@ class Teaspoon.Reporters.HTML extends Teaspoon.Reporters.BaseView
41
39
  buildLayout: ->
42
40
  el = @createEl("div")
43
41
  el.id = "teaspoon-interface"
44
- el.innerHTML = Teaspoon.Reporters.HTML.template
42
+ el.innerHTML = Teaspoon.Reporters.HTML.template()
45
43
  document.body.appendChild(el)
46
44
 
47
45
 
48
46
  buildSuiteSelect: ->
49
47
  return "" if Teaspoon.suites.all.length == 1
48
+ filename = ""
49
+ filename = "/index.html" if /index\.html$/.test(window.location.pathname)
50
50
  options = []
51
51
  for suite in Teaspoon.suites.all
52
- options.push("""<option#{if Teaspoon.suites.active == suite then " selected='selected'" else ""} value="#{suite}">#{suite}</option>""")
52
+ path = [Teaspoon.root, suite].join("/")
53
+ selected = if Teaspoon.suites.active == suite then " selected" else ""
54
+ options.push("""<option#{selected} value="#{path}#{filename}">#{suite}</option>""")
53
55
  """<select id="teaspoon-suite-select">#{options.join("")}</select>"""
54
56
 
55
57
 
@@ -135,13 +137,12 @@ class Teaspoon.Reporters.HTML extends Teaspoon.Reporters.BaseView
135
137
 
136
138
 
137
139
  setFilters: ->
138
- link = [Teaspoon.root, Teaspoon.suites.active].join('/')
139
- @filters.push("by file: #{Teaspoon.params["file"]} <a href='#{link}'>remove</a>") if Teaspoon.params["file"]
140
- @filters.push("by match: #{Teaspoon.params["grep"]} <a href='#{link}'>remove</a>") if Teaspoon.params["grep"]
140
+ @filters.push("by file: #{Teaspoon.params["file"]}") if Teaspoon.params["file"]
141
+ @filters.push("by match: #{Teaspoon.params["grep"]}") if Teaspoon.params["grep"]
141
142
 
142
143
 
143
144
  readConfig: ->
144
- @config = config if config = @cookie("teaspoon")
145
+ @config = config if config = @store("teaspoon")
145
146
 
146
147
 
147
148
  toggleConfig: (e) =>
@@ -149,16 +150,20 @@ class Teaspoon.Reporters.HTML extends Teaspoon.Reporters.BaseView
149
150
  return unless button.tagName.toLowerCase() == "button"
150
151
  name = button.getAttribute("id").replace(/^teaspoon-/, "")
151
152
  @config[name] = !@config[name]
152
- @cookie("teaspoon", @config)
153
- @refresh()
153
+ @store("teaspoon", @config)
154
+ Teaspoon.reload()
154
155
 
155
156
 
156
- changeSuite: ->
157
- window.location.href = [Teaspoon.root, @options[@options.selectedIndex].value].join('/')
157
+ changeSuite: (e) =>
158
+ options = e.target.options
159
+ window.location.href = options[options.selectedIndex].value
158
160
 
159
161
 
160
- refresh: ->
161
- window.location.href = window.location.href
162
+ store: (name, value) ->
163
+ if window.localStorage?.setItem?
164
+ @localstore(name, value)
165
+ else
166
+ @cookie(name, value)
162
167
 
163
168
 
164
169
  cookie: (name, value = undefined) ->
@@ -170,3 +175,10 @@ class Teaspoon.Reporters.HTML extends Teaspoon.Reporters.BaseView
170
175
  date = new Teaspoon.Date()
171
176
  date.setDate(date.getDate() + 365)
172
177
  document.cookie = "#{name}=#{escape(JSON.stringify(value))}; expires=#{date.toUTCString()}; path=/;"
178
+
179
+
180
+ localstore: (name, value = undefined) ->
181
+ if value == undefined
182
+ JSON.parse(unescape(localStorage.getItem(name)))
183
+ else
184
+ localStorage.setItem(name, escape(JSON.stringify(value)))
@@ -9,7 +9,7 @@ class Teaspoon.Reporters.HTML.ProgressView extends Teaspoon.Reporters.BaseView
9
9
 
10
10
 
11
11
  build: ->
12
- @el = @createEl("div", "teaspoon-indicator modeset-logo")
12
+ @el = @createEl("div", "teaspoon-indicator teaspoon-logo")
13
13
 
14
14
 
15
15
  update: ->
@@ -1,7 +1,7 @@
1
- Teaspoon.Reporters.HTML.template = """
1
+ Teaspoon.Reporters.HTML.template = -> """
2
2
  <div class="teaspoon-clearfix">
3
3
  <div id="teaspoon-title">
4
- <h1><a href="" id="teaspoon-root-link">Teaspoon</a></h1>
4
+ <h1><a href="#{Teaspoon.root}" id="teaspoon-root-link">Teaspoon</a></h1>
5
5
  <ul>
6
6
  <li>version: <b id="teaspoon-version"></b></li>
7
7
  <li id="teaspoon-env-info"></li>
@@ -28,7 +28,7 @@ Teaspoon.Reporters.HTML.template = """
28
28
  <hr/>
29
29
 
30
30
  <div id="teaspoon-filter">
31
- <h1>Filtering</h1>
31
+ <h1>Applied Filters [<a href="#{window.location.pathname}" id="teaspoon-filter-clear">remove</a>]</h1>
32
32
  <ul id="teaspoon-filter-list"></ul>
33
33
  </div>
34
34
 
@@ -1,13 +1,14 @@
1
1
  #= require_self
2
2
  #= require teaspoon/base/runner
3
3
  #= require teaspoon/base/fixture
4
+ #= require teaspoon/base/hook
4
5
  #= require teaspoon/base/reporters/html
5
6
  #= require teaspoon/base/reporters/console
6
7
 
7
8
  class @Teaspoon
8
9
  @defer: false
9
10
  @slow: 75
10
- @root: null
11
+ @root: window.location.pathname.replace(/\/+(index\.html)?$/, "").replace(/\/[^\/]*$/, "")
11
12
  @started: false
12
13
  @finished: false
13
14
  @Reporters: {}
@@ -58,3 +59,11 @@ class @Teaspoon
58
59
  messages = Teaspoon.messages
59
60
  Teaspoon.messages = []
60
61
  messages
62
+
63
+
64
+
65
+ class Teaspoon.Error extends Error
66
+
67
+ constructor: (message) ->
68
+ @name = "TeaspoonError"
69
+ @message = (message || "")
@@ -1,7 +1,9 @@
1
- #= require jasmine-1.3.1
2
1
  #= require teaspoon/base/teaspoon
3
2
  #= require teaspoon/jasmine/reporters/html
4
3
 
4
+ unless jasmine?
5
+ throw new Teaspoon.Error('Jasmine not found -- use `suite.use_framework :jasmine` and adjust or remove the `suite.javascripts` directive.')
6
+
5
7
  class Teaspoon.Runner extends Teaspoon.Runner
6
8
 
7
9
  constructor: ->
@@ -1,8 +1,10 @@
1
- #= require mocha-1.10.0
2
1
  #= require teaspoon/base/teaspoon
3
2
  #= require teaspoon/mocha/reporters/console
4
3
  #= require teaspoon/mocha/reporters/html
5
4
 
5
+ unless mocha?
6
+ throw new Teaspoon.Error('Mocha not found -- use `suite.use_framework :mocha` and adjust or remove the `suite.javascripts` directive.')
7
+
6
8
  class Teaspoon.Runner extends Teaspoon.Runner
7
9
 
8
10
  constructor: ->
@@ -18,7 +18,7 @@ class Teaspoon.Reporters.HTML extends Teaspoon.Reporters.HTML
18
18
 
19
19
 
20
20
  envInfo: ->
21
- "mocha 1.9.1"
21
+ "mocha #{_mocha_version || "[unknown version]"}"
22
22
 
23
23
 
24
24
  class Teaspoon.Reporters.HTML.SpecView extends Teaspoon.Reporters.HTML.SpecView
@@ -1,8 +1,10 @@
1
- #= require qunit-1.12.0
2
1
  #= require teaspoon/base/teaspoon
3
2
  #= require teaspoon/qunit/reporters/console
4
3
  #= require teaspoon/qunit/reporters/html
5
4
 
5
+ unless QUnit?
6
+ throw new Teaspoon.Error('QUnit not found -- use `suite.use_framework :qunit` and adjust or remove the `suite.javascripts` directive.')
7
+
6
8
  class Teaspoon.Runner extends Teaspoon.Runner
7
9
 
8
10
  constructor: ->
@@ -35,7 +35,7 @@ class Teaspoon.Reporters.HTML extends Teaspoon.Reporters.HTML
35
35
 
36
36
 
37
37
  envInfo: ->
38
- "qunit 1.11.0"
38
+ "qunit #{_qunit_version || "[unknown version]"}"
39
39
 
40
40
 
41
41
 
@@ -5,7 +5,6 @@ class TeaspoonInterface
5
5
  @input = $u("#teaspoon-filter-input")[0]
6
6
  @input.value = ""
7
7
  @input.onkeyup = @filter
8
- @input.focus()
9
8
 
10
9
 
11
10
  filter: =>
@@ -78,7 +78,7 @@ html[xmlns] #teaspoon-interface .teaspoon-clearfix {
78
78
  background-color: #18c2e8;
79
79
  }
80
80
 
81
- #teaspoon-progress .modeset-logo {
81
+ #teaspoon-progress .teaspoon-logo {
82
82
  width: 86px;
83
83
  height: 86px;
84
84
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFYAAABWCAMAAABiiJHFAAAAGFBMVEUAAADw7urz8u3y8ezz8u3z8u3z8u308+5JPTlvAAAAB3RSTlMAHt9DlG6+wwFeZgAAAtRJREFUeNrt2etyozAMBWAdHUl5/zfeZXMRjgV2TPNnp2c6HQqer4rAxAly+0p+2RlW9RtswL/BQvgF1kXw86zK38Rsw00n2dhYb0BzAgKA9m5TfI512aJZD2UfWtcxnWfxRCHvwR62HDvDCrb2KqUKo2vZkLV8uQY5iDWs6JhVmYk3RdiODa1dzLrZMr5YpYifNXfsZg14sRQ5cBVzrt1LSDb/1vqkzSW2kTs2G8grbYBLy2ZBg4tsMnywzAZViQ9Zf7DIHVXwiZnTQbP8C71tkJbF8jzLQCt2XCzMOLiAx6yW1dxdFKrnbfyst15WE/ctZa2OL7CuIn3uZvFacEs2Z91oKuQYPmpg2dn2nhA9y2M2quNM9uGiUFUG1VY9SnY77HNTIZ7jUfQoFcn/PjVv+Wo5zevDybpITM4wO7/56Jh1qQLISWzMUj4PdyzLuaCyEn2xWs8xW2LtxUbNcollNgHlfQZLLJI1FGzIWqKZDt2l4IustSwvtTbDlhW93tpcfiTBk9ZCu9hrH1tXW7btrr2V0Idatyv27PZzcsa0Zz1q1p+siggp4scr0OhZxmuwl2xs7PYrTt9x2wQPWsaNzU8+FIEefVLys2LbRmD/XnZfh6BEq7ntzEq9LVcfLHM9DUe5ZEFXbG4JWjb2rO1eCcyq+2hGCc95w5a13R1MPBdXrjmsvhSY7dZ/x7xnNU+Ki9C0uodbU+zuP4XY21T3PcvmmwI/vRRstyvifbi3TcgULCu2Hs0HGwR8tFw+ZpVSslPrpOhY3pvgIhdY6+6azM0FtmxuRGgOnGZNii5UwVUWoc9zlBuUj9iQIugiVfyYVVmPJdsF62ycsFxnbyesLaus2OvNtWSL8Oqqpo7i6tKuTiyp4+8YA2tqsnWUH6KIue/GDZ+gPv/cwTiN6kdPScIxNmkLD1/UiBPSY/2ZjoY5CSQH0M30Zx4V6TO/z8v+K/YPUO9s8Zs6f9sAAAAASUVORK5CYII=");
@@ -250,14 +250,21 @@ html[xmlns] #teaspoon-interface .teaspoon-clearfix {
250
250
  #teaspoon-filter h1 {
251
251
  float: left;
252
252
  height: 15px;
253
- margin: -11px 15px 0 0;
254
- padding: 0 4px;
253
+ margin: -11px 15px 0 10px;
254
+ padding: 0 4px 5px;
255
255
  background: #f4f3ee;
256
256
  text-align: right;
257
257
  font-size: 17px;
258
258
  font-weight: 200;
259
259
  color: #7b4f49;
260
260
  }
261
+ #teaspoon-filter h1 a {
262
+ text-decoration: none;
263
+ color: #000;
264
+ }
265
+ #teaspoon-filter h1 a:hover {
266
+ text-decoration: underline;
267
+ }
261
268
  #teaspoon-filter ul {
262
269
  margin: 0;
263
270
  padding: 3px 10px 6px;
@@ -399,7 +406,8 @@ body.teaspoon-passed #teaspoon-progress .teaspoon-indicator {
399
406
  #teaspoon-suite-list ul {
400
407
  margin: 0 0 20px 0;
401
408
  padding: 0 0 0 20px;
402
- /*background: rgba(200, 184, 161, 0.1);*/
409
+ list-style: none;
410
+ font-weight: 200;
403
411
  }
404
412
  #teaspoon-suite-list a {
405
413
  text-decoration: none;
@@ -414,10 +422,6 @@ body.teaspoon-passed #teaspoon-progress .teaspoon-indicator {
414
422
  font-size: 20px;
415
423
  border-bottom: 1px dotted #cfc8c4;
416
424
  }
417
- #teaspoon-suite-list h4 {
418
- margin: 0;
419
- font-weight: 200;
420
- }
421
425
 
422
426
  /* Responsive
423
427
  *---------------------------------------------------------------------------*/
@@ -0,0 +1,32 @@
1
+ class Teaspoon::SuiteController < ActionController::Base
2
+ helper Teaspoon::SuiteHelper rescue nil
3
+
4
+ before_filter :prepend_fixture_paths
5
+
6
+ layout false
7
+
8
+ def index
9
+ @suites = Teaspoon::Suite.all
10
+ end
11
+
12
+ def show
13
+ @suite = Teaspoon::Suite.new(params)
14
+ end
15
+
16
+ def hook
17
+ Teaspoon::Suite.new(params).hooks[params[:hook].to_s].each { |hook| hook.call }
18
+ render nothing: true
19
+ end
20
+
21
+ def fixtures
22
+ render "/#{params[:filename]}"
23
+ end
24
+
25
+ private
26
+
27
+ def prepend_fixture_paths
28
+ Teaspoon.configuration.fixture_paths.each do |path|
29
+ prepend_view_path Teaspoon.configuration.root.join(path)
30
+ end
31
+ end
32
+ end
File without changes
@@ -0,0 +1,4 @@
1
+ <%= javascript_include_tag *@suite.spec_assets %>
2
+ <script type="text/javascript">
3
+ Teaspoon.onWindowLoad(Teaspoon.execute);
4
+ </script>
@@ -0,0 +1,19 @@
1
+ <%
2
+ rails_config = Rails.application.config
3
+ require_options = {baseUrl: rails_config.assets.prefix}
4
+ require_options.merge!(rails_config.requirejs.user_config) if rails_config.respond_to?(:requirejs)
5
+ specs = @suite.spec_assets(false).map{ |s| "#{s.gsub(/\.js.*$/, "")}" }
6
+ %>
7
+
8
+ <%= javascript_include_tag @suite.helper %>
9
+ <script type="text/javascript">
10
+ Teaspoon.onWindowLoad(function () {
11
+ // setup the Teaspoon path prefix to load /assets
12
+ require.config(<%= require_options.to_json.html_safe %>);
13
+
14
+ // require specs by striping off the .js file extension
15
+ require(<%= specs.to_json.html_safe %>, function() {
16
+ Teaspoon.execute();
17
+ });
18
+ });
19
+ </script>
@@ -3,9 +3,8 @@
3
3
  <head>
4
4
  <title>Teaspoon :: Suites</title>
5
5
  <meta name="viewport" content="width=device-width, user-scalable=no">
6
- <%= csrf_meta_tags %>
7
- <%= stylesheet_link_tag_for_teaspoon *(@suites.first.present? ? @suites.first.stylesheets : "teaspoon") %>
8
- <%= javascript_include_tag_for_teaspoon "teaspoon-teaspoon" %>
6
+ <%= stylesheet_link_tag "teaspoon" %>
7
+ <%= javascript_include_tag "teaspoon-teaspoon" %>
9
8
  </head>
10
9
  <body>
11
10
  <div id="teaspoon-interface">
@@ -17,19 +16,19 @@
17
16
  <li><a href="http://github.com/modeset/teaspoon" target="blank">http://github.com/modeset/teaspoon</a></li>
18
17
  </ul>
19
18
  </div>
20
- <div id="teaspoon-progress"><div class="teaspoon-indicator modeset-logo"></div></div>
19
+ <div id="teaspoon-progress"><div class="teaspoon-indicator teaspoon-logo"></div></div>
21
20
  </div>
22
21
  <div id="teaspoon-controls" class="teaspoon-clearfix">
23
- <input type="text" id="teaspoon-filter-input" placeholder="filter files"/>
22
+ <input type="text" id="teaspoon-filter-input" placeholder="filter list" autofocus/>
24
23
  </div>
25
24
  <hr/>
26
25
  <ul id="teaspoon-suite-list">
27
26
  <% for suite in @suites %>
28
27
  <li class="suite">
29
- <h1><%= link_to suite.name, suite.link %></h1>
28
+ <h1><%= link_to suite.name, teaspoon.suite_path(suite.name) %></h1>
30
29
  <ul class="file">
31
30
  <% for file in suite.spec_files %>
32
- <h4><%= link_to file[:name], suite.link(file: file[:path]) %></h4>
31
+ <li><%= link_to file[:name], teaspoon.suite_path(suite.name, file: file[:path]) %></li>
33
32
  <% end %>
34
33
  </ul>
35
34
  </li>
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Teaspoon :: Javascript Test Runner</title>
5
+ <meta name="viewport" content="width=device-width, user-scalable=no">
6
+ <%= csrf_meta_tags %>
7
+
8
+ <%= stylesheet_link_tag *@suite.stylesheets %>
9
+ <%= javascript_include_tag *@suite.javascripts %>
10
+ <script type="text/javascript">
11
+ Teaspoon.version = <%= Teaspoon::VERSION.to_json.html_safe %>;
12
+ Teaspoon.suites = <%= {all: Teaspoon.configuration.suite_configs.keys, active: @suite.name}.to_json.html_safe %>;
13
+ </script>
14
+ <%= render @suite.boot_partial %>
15
+ </head>
16
+ <body data-no-turbolink>
17
+ <%= render @suite.body_partial %>
18
+ </body>
19
+ </html>
data/bin/teaspoon CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- root = File.expand_path('../lib', __FILE__)
2
+ root = File.expand_path('../../lib', __FILE__)
3
3
  $:.unshift(root) unless $:.include?(root)
4
4
 
5
5
  require "teaspoon/command_line"
data/config/routes.rb CHANGED
@@ -1,6 +1,16 @@
1
1
  Teaspoon::Engine.routes.draw do
2
- get "/fixtures/*filename", to: "spec#fixtures"
3
- get "/:suite", to: "spec#runner", defaults: { suite: "default" }
4
- post "/:suite/hooks(/:group)", to: "spec#hooks", defaults: { suite: "default", group: "default" }
5
- root to: "spec#suites"
2
+
3
+ root to: "suite#index"
4
+
5
+ match "/fixtures/*filename",
6
+ to: "suite#fixtures", via: [:get]
7
+
8
+ match "/:suite", as: "suite",
9
+ to: "suite#show", via: [:get],
10
+ defaults: { suite: "default" }
11
+
12
+ match "/:suite/:hook", as: "suite_hook",
13
+ to: "suite#hook", via: [:get, :post],
14
+ defaults: { suite: "default", hook: "default" }
15
+
6
16
  end