teaspoon 1.1.3 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +47 -0
  3. data/MIT.LICENSE +2 -2
  4. data/README.md +56 -35
  5. data/app/assets/javascripts/teaspoon/hook.coffee +1 -1
  6. data/app/assets/javascripts/teaspoon/teaspoon.coffee +13 -1
  7. data/app/controllers/teaspoon/suite_controller.rb +18 -13
  8. data/app/views/teaspoon/suite/_boot.html.erb +1 -1
  9. data/app/views/teaspoon/suite/index.html.erb +1 -1
  10. data/lib/generators/teaspoon/install/install_generator.rb +34 -34
  11. data/lib/generators/teaspoon/install/templates/MISSING_FRAMEWORK +1 -1
  12. data/lib/generators/teaspoon/install/templates/POST_INSTALL +1 -1
  13. data/lib/generators/teaspoon/install/templates/env_comments.rb.tt +9 -7
  14. data/lib/tasks/teaspoon/info.rake +1 -1
  15. data/lib/teaspoon/command_line.rb +76 -76
  16. data/lib/teaspoon/configuration.rb +4 -4
  17. data/lib/teaspoon/console.rb +41 -40
  18. data/lib/teaspoon/coverage.rb +29 -25
  19. data/lib/teaspoon/deprecated.rb +1 -1
  20. data/lib/teaspoon/driver.rb +1 -1
  21. data/lib/teaspoon/driver/browserstack.rb +111 -0
  22. data/lib/teaspoon/driver/phantomjs.rb +25 -26
  23. data/lib/teaspoon/driver/phantomjs/runner.js +31 -3
  24. data/lib/teaspoon/driver/selenium.rb +13 -9
  25. data/lib/teaspoon/engine.rb +32 -27
  26. data/lib/teaspoon/environment.rb +28 -28
  27. data/lib/teaspoon/exceptions.rb +7 -7
  28. data/lib/teaspoon/exporter.rb +23 -23
  29. data/lib/teaspoon/formatter/base.rb +64 -46
  30. data/lib/teaspoon/formatter/clean.rb +2 -2
  31. data/lib/teaspoon/formatter/documentation.rb +40 -40
  32. data/lib/teaspoon/formatter/dot.rb +12 -12
  33. data/lib/teaspoon/formatter/json.rb +21 -21
  34. data/lib/teaspoon/formatter/junit.rb +52 -51
  35. data/lib/teaspoon/formatter/modules/report_module.rb +34 -32
  36. data/lib/teaspoon/formatter/pride.rb +21 -21
  37. data/lib/teaspoon/formatter/rspec_html.rb +31 -31
  38. data/lib/teaspoon/formatter/snowday.rb +6 -5
  39. data/lib/teaspoon/formatter/swayze_or_oprah.rb +91 -91
  40. data/lib/teaspoon/formatter/tap.rb +29 -29
  41. data/lib/teaspoon/formatter/tap_y.rb +57 -57
  42. data/lib/teaspoon/formatter/teamcity.rb +63 -63
  43. data/lib/teaspoon/framework/base.rb +1 -1
  44. data/lib/teaspoon/instrumentation.rb +18 -18
  45. data/lib/teaspoon/registry.rb +9 -9
  46. data/lib/teaspoon/registry/has_default.rb +2 -2
  47. data/lib/teaspoon/runner.rb +37 -37
  48. data/lib/teaspoon/server.rb +30 -29
  49. data/lib/teaspoon/suite.rb +68 -57
  50. data/lib/teaspoon/utility.rb +6 -0
  51. data/lib/teaspoon/version.rb +1 -1
  52. metadata +22 -15
  53. data/lib/teaspoon/driver/capybara_webkit.rb +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: baf9f6b71a048c4a8ca1490cc8ef46a05b993803
4
- data.tar.gz: 2549ceb1312eb411c92f1592d5013263074093fc
2
+ SHA256:
3
+ metadata.gz: 8f1d6fd45df7a0ad1eff691a01c1ccc82a601186b70dc5d9bd9a90e008d9549b
4
+ data.tar.gz: 2ba946ee6bcdeb488db97cc668c1c6a16d94a7ba58db4056ca23def8fdc4402f
5
5
  SHA512:
6
- metadata.gz: a428ef8433d1bea881e3de18b3d1f87d6805c75fbd1e6ae604ed5da780ca14e447c26369a3887be8b7803768dffd6dfce99b5ad16048f84badf98c91062632db
7
- data.tar.gz: e8bc26bd42a72786b80e461fce98fc254f587766049d59b602daa7ad05fccbd8b08a7d0ebf78f3b35eac03f87b6301e52a1dda1515ebc2ebcd3ac118a527aefc
6
+ metadata.gz: b45c374bb048ad82393b679db5f6ceebb8916a38b8af80f8e7b6177dd856e9e34def5bd454a6b74661745a8047a0fa8b92877132c7bdc2d5dc459395d488ec14
7
+ data.tar.gz: 89c7315b3ed8e7c386321f981bf0261289d4585a0aadc8f713425fe5638455f5aaa95284fec9a28bed7479748d7a94c843fad75da5ad6cafeee8af6fb7135463
data/CHANGELOG.md CHANGED
@@ -1,9 +1,56 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 1.2.2
4
+
5
+ * make sure all tests pass with rails 4.2 - 6.1 (few pending excluded PR welcome)
6
+ * ruby supported 2.5 to 2.7 works, unknown about 3.0
7
+ * remove monkey-patch on `javascript_include_tag`
8
+
9
+ ### 1.2.1
10
+
11
+ * require utility in console to get Teaspoon.root (#562)
12
+ * Update ruby version requirement to allow ruby 3.0 (#583)
13
+ * Fix coverage output path (#579)
14
+ * Delay using Rails until loaded (#582)
15
+ * Run tests via Github Actions (#588)
16
+
17
+ ### 1.2.0
18
+
19
+ #### Enhancements
20
+
21
+ * Add Rails 6 (beta1) support (#556)
22
+ * Allow passing selenium options (#537)
23
+
3
24
  #### Bug Fixes
4
25
 
26
+ * Removes Rails 3 & 4 support (#560)
27
+ * Removes support for capybara webkit (#560)
28
+ * Fixes gem coffeescript assets being discovered by sprockets (#405)
29
+ * Many other small changes/fixes
30
+
31
+ ### 1.1.5
32
+
33
+ #### Enhancements
34
+
35
+ * Adds support for Rails 5
36
+
37
+ #### Bug Fixes
38
+
39
+ * Fixes an ActionView version related issue.
40
+ * Changes before_filter to before_action where possible (Rails 3 vs. Rails 5)
41
+
42
+
43
+ ### 1.1.4
44
+
45
+ #### Bug Fixes
46
+
47
+ * Fixes an ActionView version related issue.
48
+
49
+
5
50
  ### 1.1.3
6
51
 
52
+ This was an erroneous release, of the rails_5 branch. oops.
53
+
7
54
  #### Bug Fixes
8
55
 
9
56
  * Fix for version check of ActionView, to expand the version checking for security/bug fix releases.
data/MIT.LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- Copyright 2015 Jeremy Jackson / ModeSet
1
+ Copyright 2019 Jeremy Jackson
2
2
 
3
- https://github.com/modeset/teaspoon
3
+ https://github.com/jejacks0n/teaspoon
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -2,37 +2,34 @@ Teaspoon
2
2
  ========
3
3
 
4
4
  [![Gem Version](https://img.shields.io/gem/v/teaspoon.svg)](https://rubygems.org/gems/teaspoon)
5
- [![Dependency Status](https://gemnasium.com/modeset/teaspoon.svg)](https://gemnasium.com/modeset/teaspoon)
6
- [![Build Status](https://img.shields.io/travis/modeset/teaspoon.svg)](https://travis-ci.org/modeset/teaspoon)
7
- [![Code Climate](https://codeclimate.com/github/modeset/teaspoon/badges/gpa.svg)](https://codeclimate.com/github/modeset/teaspoon)
8
- [![Test Coverage](https://codeclimate.com/github/modeset/teaspoon/badges/coverage.svg)](https://codeclimate.com/github/modeset/teaspoon)
9
- [![License](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
5
+ [![Build Status](https://travis-ci.org/jejacks0n/teaspoon.svg?branch=master)](https://travis-ci.org/jejacks0n/teaspoon)
6
+ [![Maintainability](https://api.codeclimate.com/v1/badges/70c116d18acd407d9201/maintainability)](https://codeclimate.com/github/jejacks0n/teaspoon/maintainability)
7
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/70c116d18acd407d9201/test_coverage)](https://codeclimate.com/github/jejacks0n/teaspoon/test_coverage)
8
+ [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)
9
+ [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
10
10
 
11
- <img src="https://raw.github.com/modeset/teaspoon/master/screenshots/logo_big.png" alt="Logo by Morgan Keys" align="right" />
12
- <sup>Logo by [Morgan Keys](http://www.morganrkeys.com/)</sup>
11
+ <img src="https://raw.github.com/jejacks0n/teaspoon/master/screenshots/logo_big.png" alt="Logo by Morgan Keys" align="right" />
12
+ <sup>Logo by [Morgan Keys](https://twitter.com/morganrkeys)</sup>
13
13
 
14
- Teaspoon is a Javascript test runner built for Rails. It can run tests in the browser and headless using PhantomJS, Selenium WebDriver, or Capybara Webkit.
14
+ Teaspoon is a Javascript test runner built for Rails. It can run tests in the browser and headless using PhantomJS, or Selenium WebDriver. It can also run your tests on selenium-webgrid providers such as [BrowserStack](https://www.browserstack.com).
15
15
 
16
- Feedback, ideas and pull requests are always welcome, or you can hit us up on Twitter @modeset_.
17
-
18
- [![Join the chat at https://gitter.im/modeset/teaspoon](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/modeset/teaspoon?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
19
-
20
- The goal of Teaspoon is to stay simple while also providing the most complete Javascript testing solution for Rails.
16
+ The goal of Teaspoon is to be simple to use while also providing the most complete Javascript testing solution for Rails.
21
17
 
22
18
  Teaspoon takes advantage of the Rails asset pipeline, and ships with support for Jasmine, Mocha, and QUnit.
23
19
 
24
- If you'd like to use Teaspoon with [Guard](https://github.com/guard/guard), check out the [guard-teaspoon](https://github.com/modeset/guard-teaspoon) project. Or, if you want to use the [Spring](https://github.com/rails/spring) preloader, try the unofficial [spring-commands-teaspoon](https://github.com/alejandrobabio/spring-commands-teaspoon).
20
+ If you'd like to use Teaspoon with [Guard](https://github.com/guard/guard), check out the [guard-teaspoon](https://github.com/jejacks0n/guard-teaspoon) project. Or, if you want to use the [Spring](https://github.com/rails/spring) preloader, try the unofficial [spring-commands-teaspoon](https://github.com/alejandrobabio/spring-commands-teaspoon).
21
+
25
22
 
26
23
  ## Screenshots
27
24
 
28
25
  ### Running in the console
29
- ![Console Reporter](https://raw.github.com/modeset/teaspoon/master/screenshots/console-reporter.png)
26
+ ![Console Reporter](https://raw.github.com/jejacks0n/teaspoon/master/screenshots/console-reporter.png)
30
27
 
31
28
  ### Running in the console using [Tapout](https://github.com/rubyworks/tapout)
32
- ![Console Reporter Tapout](https://raw.github.com/modeset/teaspoon/master/screenshots/console-reporter-tapout.png)
29
+ ![Console Reporter Tapout](https://raw.github.com/jejacks0n/teaspoon/master/screenshots/console-reporter-tapout.png)
33
30
 
34
31
  ### Running in the browser
35
- ![Browser Reporter](https://raw.github.com/modeset/teaspoon/master/screenshots/html-reporter.jpg)
32
+ ![Browser Reporter](https://raw.github.com/jejacks0n/teaspoon/master/screenshots/html-reporter.jpg)
36
33
 
37
34
 
38
35
  ## Table of Contents
@@ -47,7 +44,7 @@ If you'd like to use Teaspoon with [Guard](https://github.com/guard/guard), chec
47
44
  8. [Test Frameworks](#test-frameworks)
48
45
  9. [Support Libraries](#support-libraries)
49
46
  10. [CI Support](#ci-support)
50
-
47
+ 11. [With BrowserStack](#with-browserstack)
51
48
 
52
49
  ## Installation
53
50
 
@@ -65,14 +62,14 @@ Run the install generator to get the environment file and a basic spec helper. I
65
62
  rails generate teaspoon:install --coffee
66
63
  ```
67
64
 
68
- To run Teaspoon headless you'll need PhantomJS, Selenium Webdriver or Capybara Webkit. We recommend PhantomJS, which you can install with homebrew, npm or [as a download](http://phantomjs.org/download.html).
65
+ To run Teaspoon headless you'll need PhantomJS or Selenium Webdriver.
69
66
 
70
67
 
71
68
  ## Usage
72
69
 
73
70
  Teaspoon uses the Rails asset pipeline to serve files. This allows you to use `= require` in your test files, and allows you use things like HAML or RABL/JBuilder within your fixtures.
74
71
 
75
- Here's a great [Quick Start Walkthrough](https://github.com/modeset/teaspoon/wiki/Quick-Start-Walkthrough) for writing and running your first tests.
72
+ Here's a great [Quick Start Walkthrough](https://github.com/jejacks0n/teaspoon/wiki/Quick-Start-Walkthrough) for writing and running your first tests.
76
73
 
77
74
  You can run Teaspoon three ways -- in the browser, via the rake task, and using the command line interface (CLI).
78
75
 
@@ -123,7 +120,7 @@ bundle exec teaspoon --help
123
120
 
124
121
  Depending on which framework you use this can differ, and there's an expectation that you have a certain level of familiarity with your chosen test framework.
125
122
 
126
- Teaspoon supports [Jasmine](http://pivotal.github.com/jasmine), [Mocha](https://github.com/mochajs/mocha) and [QUnit](http://qunitjs.com). And since it's possible to use the asset pipeline, feel free to use the `= require` directive throughout your specs and spec helpers.
123
+ Teaspoon supports [Jasmine](http://jasmine.github.io/2.0/introduction.html), [Mocha](https://github.com/mochajs/mocha) and [QUnit](http://qunitjs.com). And since it's possible to use the asset pipeline, feel free to use the `= require` directive throughout your specs and spec helpers.
127
124
 
128
125
  Here's a basic spec written in Javascript using Jasmine:
129
126
 
@@ -139,7 +136,7 @@ describe("My great feature", function() {
139
136
  });
140
137
  ```
141
138
 
142
- You can also check out the examples of a [Mocha Spec](https://github.com/modeset/teaspoon/wiki/Using-Mocha), and a [QUnit Test](https://github.com/modeset/teaspoon/wiki/Using-QUnit).
139
+ You can also check out the examples of a [Mocha Spec](https://github.com/jejacks0n/teaspoon/wiki/Using-Mocha), and a [QUnit Test](https://github.com/jejacks0n/teaspoon/wiki/Using-QUnit).
143
140
 
144
141
  ### Pending Specs
145
142
 
@@ -174,7 +171,7 @@ setTimeout(Teaspoon.execute, 1000); // defers execution for 1 second
174
171
 
175
172
  ### Using Require.js
176
173
 
177
- There's a wiki article that goes into more depth on using [RequireJS with Teaspoon](https://github.com/modeset/teaspoon/wiki/RequireJS-with-Teaspoon). But in simple terms you can configure your suite to boot with RequireJS by setting the suite `boot_partial` directive to `"boot_require_js"`.
174
+ There's a wiki article that goes into more depth on using [RequireJS with Teaspoon](https://github.com/jejacks0n/teaspoon/wiki/RequireJS-with-Teaspoon). But in simple terms you can configure your suite to boot with RequireJS by setting the suite `boot_partial` directive to `"boot_require_js"`.
178
175
 
179
176
  Be sure to require `require.js` in your spec helper. Teaspoon doesn't include it as a support library, so you'll need to provide your own.
180
177
 
@@ -243,7 +240,7 @@ describe("Using fixtures", function() {
243
240
  });
244
241
  ```
245
242
 
246
- Check out some example of using fixtures with [Mocha](https://github.com/modeset/teaspoon/wiki/Using-Mocha), [QUnit](https://github.com/modeset/teaspoon/wiki/Using-QUnit).
243
+ Check out some example of using fixtures with [Mocha](https://github.com/jejacks0n/teaspoon/wiki/Using-Mocha), [QUnit](https://github.com/jejacks0n/teaspoon/wiki/Using-QUnit).
247
244
 
248
245
  **Note:** The element that Teaspoon creates is "#teaspoon-fixtures", in case you need to access it directly and put your own fixtures in manually.
249
246
 
@@ -270,6 +267,20 @@ config.suite :my_suite do |suite|
270
267
  end
271
268
  ```
272
269
 
270
+ When defining multiple suites and running the tests on a CI (like Jenkins), you might need the output of `bundle exec teaspoon` in your XML-reports.
271
+ To get one XML-file per suite you are running, you might want to add e.g a `junit` formatter which creates one result file per suite.
272
+
273
+ ```ruby
274
+ config.formatters = ["junit>#{Rails.root.join(["spec", "reports", "teaspoon_%{suite_name}.xml"])}"]
275
+ ```
276
+
277
+ Will create a single file for each defined test-suite under `spec/reports/teasoon_%{suite_name}.xml`.
278
+ Allowed placeholders are:
279
+
280
+ - `suite_name`: the name defined by your config (`config.suite :my_suite ...`)
281
+ - `date`: the execution timestamp of your test (`Date.now.to_i`)
282
+
283
+
273
284
  ### Hooks
274
285
 
275
286
  Hooks are designed to facilitate loading fixtures or other things that might be required on the back end before, after, or during running a suite or test.
@@ -372,18 +383,18 @@ end
372
383
 
373
384
  ## Configuration
374
385
 
375
- When you install Teaspoon a `teaspoon_env.rb` file is generated that contains good documentation for each configuration directive. Otherwise you can get a refresher by checking the [Teaspoon Configuration](https://github.com/modeset/teaspoon/wiki/Teaspoon-Configuration) article.
386
+ When you install Teaspoon a `teaspoon_env.rb` file is generated that contains good documentation for each configuration directive. Otherwise you can get a refresher by checking the [Teaspoon Configuration](https://github.com/jejacks0n/teaspoon/wiki/Teaspoon-Configuration) article.
376
387
 
377
388
  **Note** If you want `teaspoon_env.rb` to live in a location other than the default install path, you can specify an alternate path in a `TEASPOON_ENV` environment variable (eg `$ TEASPOON_ENV=config/teaspoon.rb teaspoon`).
378
389
 
379
390
 
380
391
  ## Test Frameworks
381
392
 
382
- [Jasmine](http://pivotal.github.com/jasmine) is one of the first BDD-style frameworks. We've been using Jasmine for a long time, and have been pretty happy with it. It lacks a few important things that could be in a test framework, so we've done a little bit of work to make that nicer. Like adding pending spec support.
393
+ [Jasmine](https://jasmine.github.io/) is one of the first BDD-style frameworks. We've been using Jasmine for a long time, and have been pretty happy with it. It lacks a few important things that could be in a test framework, so we've done a little bit of work to make that nicer. Like adding pending spec support.
383
394
 
384
- [Mocha](http://visionmedia.github.com/mocha) came up while we were working on Teaspoon -- we read up about it and thought it was a pretty awesome library with some really great approaches to some of the things that some of us browser types should consider more often, so we included it and added support for it. We encourage you to give it a try. Read more about [Using Mocha](https://github.com/modeset/teaspoon/wiki/Using-Mocha) with Teaspoon.
395
+ [Mocha](http://mochajs.org/) came up while we were working on Teaspoon -- we read up about it and thought it was a pretty awesome library with some really great approaches to some of the things that some of us browser types should consider more often, so we included it and added support for it. We encourage you to give it a try. Read more about [Using Mocha](https://github.com/jejacks0n/teaspoon/wiki/Using-Mocha) with Teaspoon.
385
396
 
386
- [QUnit](http://qunitjs.com) We're not sure about how many people use QUnit, but we like jQuery, so we added it. Read more about [Using QUnit](https://github.com/modeset/teaspoon/wiki/Using-QUnit) with Teaspoon.
397
+ [QUnit](http://qunitjs.com) We're not sure about how many people use QUnit, but we like jQuery, so we added it. Read more about [Using QUnit](https://github.com/jejacks0n/teaspoon/wiki/Using-QUnit) with Teaspoon.
387
398
 
388
399
  If you'd like to see what frameworks and versions Teaspoon supports, you can run `rake teaspoon:info`. The results of this will be restricted by what framework gems you have included in your Gemfile.
389
400
 
@@ -435,23 +446,33 @@ If you want to generate reports that CI can use you can install Istanbul for cov
435
446
  We encourage you to experiment and let us know. Feel free to create a wiki article about what you did to get it working on your CI setup.
436
447
 
437
448
 
449
+ ## With [BrowserStack](https://www.browserstack.com)
450
+
451
+ Running your javascript tests on the BrowserStack infrastructure is easy with the included `browserstack` driver.
452
+
453
+ In `teaspoon_env.rb` configure your driver to `config.driver = :browserstack`. You must add the browsers you'd like to test on as an array of hashes with key `capabilities` in `config.driver_options`. More details about the driver configurations are available on the [Using BrowserStack WebDriver](https://github.com/jejacks0n/teaspoon/wiki/Using-BrowserStack-WebDriver) wiki article.
454
+
455
+ By default you can run 10 tests in parallel by default, and the number of tests running in parallel can be specified using the `max_parallel` driver option.
456
+
457
+ Now you can run Teaspoon locally and can see your tests running on the [BrowserStack Automate Dashboard](https://browserstack.com/automate).
458
+
459
+
438
460
  ## Alternative Projects
439
461
 
440
- [Konacha](https://github.com/jfirebaugh/konacha)
441
- [Jasminerice](https://github.com/bradphelan/jasminerice)
442
- [Evergreen](https://github.com/abepetrillo/evergreen)
443
- [jasmine-rails](https://github.com/searls/jasmine-rails)
444
- [guard-jasmine](https://github.com/netzpirat/guard-jasmine)
462
+ - [Konacha](https://github.com/jfirebaugh/konacha)
463
+ - [Jasminerice](https://github.com/bradphelan/jasminerice)
464
+ - [Evergreen](https://github.com/abepetrillo/evergreen)
465
+ - [jasmine-rails](https://github.com/searls/jasmine-rails)
466
+ - [guard-jasmine](https://github.com/netzpirat/guard-jasmine)
445
467
 
446
468
 
447
469
  ## License
448
470
 
449
471
  Licensed under the [MIT License](http://creativecommons.org/licenses/MIT/)
450
472
 
451
- Copyright 2014 [Mode Set](https://github.com/modeset)
473
+ Copyright 2016 [jejacks0n](https://github.com/jejacks0n)
452
474
 
453
475
  All licenses for the bundled Javascript libraries are included (MIT/BSD).
454
476
 
455
477
 
456
478
  ## Make Code Not War
457
- ![crest](https://secure.gravatar.com/avatar/aa8ea677b07f626479fd280049b0e19f?s=75)
@@ -19,4 +19,4 @@ Teaspoon.hook = (name, payload = {}) ->
19
19
 
20
20
  xhrRequest "#{Teaspoon.suites.active}/#{name}", payload, ->
21
21
  return unless xhr.readyState == 4
22
- throw("Unable to call hook \"#{url}\".") unless xhr.status == 200
22
+ throw JSON.parse(xhr.response).err
@@ -32,6 +32,16 @@ class @Teaspoon
32
32
  new (Teaspoon.resolveClass("Runner"))()
33
33
 
34
34
 
35
+ @setupErrorHandler: ->
36
+ originalOnError = window.onerror
37
+ window.onerror = (message) ->
38
+ originalOnError(arguments...) if originalOnError && originalOnError.call
39
+ return if Teaspoon.started
40
+ Teaspoon.messages.push JSON.stringify
41
+ _teaspoon: true
42
+ type: "exception"
43
+ message: message
44
+
35
45
  @reload: ->
36
46
  window.location.reload()
37
47
 
@@ -85,10 +95,12 @@ class @Teaspoon
85
95
 
86
96
 
87
97
  @checkNamespace: (root, klass) ->
88
- namespaces = klass.split('.')
98
+ namespaces = klass.split(".")
89
99
  scope = root
90
100
 
91
101
  for namespace, i in namespaces
92
102
  return false if !(scope = scope[namespace])
93
103
 
94
104
  return scope
105
+
106
+ Teaspoon.setupErrorHandler()
@@ -18,8 +18,13 @@ class Teaspoon::SuiteController < ActionController::Base
18
18
 
19
19
  def hook
20
20
  hooks = Teaspoon::Suite.new(params).hooks[params[:hook].to_s]
21
- hooks.each { |hook| hook.call(hook_params(params[:args])) }
22
- head(:success)
21
+
22
+ if hooks.present?
23
+ hooks.each { |hook| hook.call(hook_params(params[:args])) }
24
+ head(:ok)
25
+ else
26
+ render status: :not_found, json: { err: "The `#{params[:hook]}` hook is not defined in the `#{params[:suite]}` suite " }
27
+ end
23
28
  end
24
29
 
25
30
  def fixtures
@@ -28,18 +33,18 @@ class Teaspoon::SuiteController < ActionController::Base
28
33
 
29
34
  private
30
35
 
31
- def check_env
32
- Teaspoon::Environment.check_env!
33
- end
36
+ def check_env
37
+ Teaspoon::Environment.check_env!
38
+ end
34
39
 
35
- def prepend_fixture_paths
36
- Teaspoon.configuration.fixture_paths.each do |path|
37
- prepend_view_path Teaspoon.configuration.root.join(path)
40
+ def prepend_fixture_paths
41
+ Teaspoon.configuration.fixture_paths.each do |path|
42
+ prepend_view_path Teaspoon.configuration.root.join(path)
43
+ end
38
44
  end
39
- end
40
45
 
41
- def hook_params(params)
42
- return params.permit!.to_h if params.respond_to?(:permit!)
43
- params
44
- end
46
+ def hook_params(params)
47
+ return params.permit!.to_h if params.respond_to?(:permit!)
48
+ params
49
+ end
45
50
  end
@@ -1,4 +1,4 @@
1
- <%= javascript_include_tag *@suite.spec_assets, debug: @suite.config.expand_assets, allow_non_precompiled: true %>
1
+ <%= javascript_include_tag *@suite.spec_assets, debug: @suite.config.expand_assets %>
2
2
  <script type="text/javascript">
3
3
  Teaspoon.onWindowLoad(Teaspoon.execute);
4
4
  </script>
@@ -13,7 +13,7 @@
13
13
  <h1>Teaspoon</h1>
14
14
  <ul>
15
15
  <li>version: <b><%= Teaspoon::VERSION %></b></li>
16
- <li><a href="http://github.com/modeset/teaspoon" target="blank">http://github.com/modeset/teaspoon</a></li>
16
+ <li><a href="http://github.com/jejacks0n/teaspoon" target="blank">http://github.com/jejacks0n/teaspoon</a></li>
17
17
  </ul>
18
18
  </div>
19
19
  <div id="teaspoon-progress"><div class="teaspoon-indicator teaspoon-logo"></div></div>
@@ -71,49 +71,49 @@ module Teaspoon
71
71
 
72
72
  private
73
73
 
74
- def described_frameworks
75
- Teaspoon::Framework.available.map do |framework, options|
76
- klass = Teaspoon::Framework.fetch(framework)
77
- "#{framework}: versions[#{klass.versions.join(', ')}]"
74
+ def described_frameworks
75
+ Teaspoon::Framework.available.map do |framework, options|
76
+ klass = Teaspoon::Framework.fetch(framework)
77
+ "#{framework}: versions[#{klass.versions.join(', ')}]"
78
+ end
78
79
  end
79
- end
80
80
 
81
- def framework
82
- @framework ||= begin
83
- framework = Teaspoon::Framework.fetch(options[:framework])
84
- source_paths
85
- @source_paths = framework.template_paths + @source_paths
86
- framework
81
+ def framework
82
+ @framework ||= begin
83
+ framework = Teaspoon::Framework.fetch(options[:framework])
84
+ source_paths
85
+ @source_paths = framework.template_paths + @source_paths
86
+ framework
87
+ end
87
88
  end
88
- end
89
89
 
90
- def suite
91
- @suite ||= begin
92
- config = Teaspoon::Configuration::Suite.new
93
- framework.modify_config(config)
94
- config
90
+ def suite
91
+ @suite ||= begin
92
+ config = Teaspoon::Configuration::Suite.new
93
+ framework.modify_config(config)
94
+ config
95
+ end
95
96
  end
96
- end
97
97
 
98
- def version
99
- @version ||= options[:version] ? determine_requested_version : framework.versions.last
100
- end
98
+ def version
99
+ @version ||= options[:version] ? determine_requested_version : framework.versions.last
100
+ end
101
101
 
102
- def determine_requested_version
103
- return options[:version] if framework.versions.include?(options[:version])
104
- raise Teaspoon::UnknownFrameworkVersion.new(name: framework.name, version: options[:version])
105
- end
102
+ def determine_requested_version
103
+ return options[:version] if framework.versions.include?(options[:version])
104
+ raise Teaspoon::UnknownFrameworkVersion.new(name: framework.name, version: options[:version])
105
+ end
106
106
 
107
- def abort_with_message
108
- if Teaspoon::Framework.available.empty?
109
- readme "MISSING_FRAMEWORK"
110
- else
111
- message = "Unknown framework: #{options[:framework]}#{options[:version] ? "[#{options[:version]}]" : ''}"
112
- message << "\n Available: #{described_frameworks.join("\n ")}"
113
- say_status message, nil, :red
107
+ def abort_with_message
108
+ if Teaspoon::Framework.available.empty?
109
+ readme "MISSING_FRAMEWORK"
110
+ else
111
+ message = "Unknown framework: #{options[:framework]}#{options[:version] ? "[#{options[:version]}]" : ''}"
112
+ message << "\n Available: #{described_frameworks.join("\n ")}"
113
+ say_status message, nil, :red
114
+ end
115
+ exit(1)
114
116
  end
115
- exit(1)
116
- end
117
117
  end
118
118
  end
119
119
  end