teaspoon 1.1.2 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +47 -0
- data/MIT.LICENSE +2 -2
- data/README.md +56 -35
- data/app/assets/javascripts/teaspoon/hook.coffee +1 -1
- data/app/assets/javascripts/teaspoon/teaspoon.coffee +13 -1
- data/app/controllers/teaspoon/suite_controller.rb +25 -11
- data/app/views/teaspoon/suite/index.html.erb +1 -1
- data/lib/generators/teaspoon/install/install_generator.rb +34 -34
- data/lib/generators/teaspoon/install/templates/MISSING_FRAMEWORK +1 -1
- data/lib/generators/teaspoon/install/templates/POST_INSTALL +1 -1
- data/lib/generators/teaspoon/install/templates/_boot.html.erb +1 -1
- data/lib/generators/teaspoon/install/templates/env_comments.rb.tt +9 -7
- data/lib/tasks/teaspoon/info.rake +1 -1
- data/lib/teaspoon/command_line.rb +76 -76
- data/lib/teaspoon/configuration.rb +4 -4
- data/lib/teaspoon/console.rb +41 -40
- data/lib/teaspoon/coverage.rb +29 -25
- data/lib/teaspoon/deprecated.rb +1 -1
- data/lib/teaspoon/driver.rb +1 -1
- data/lib/teaspoon/driver/browserstack.rb +111 -0
- data/lib/teaspoon/driver/phantomjs.rb +25 -26
- data/lib/teaspoon/driver/phantomjs/runner.js +31 -3
- data/lib/teaspoon/driver/selenium.rb +13 -9
- data/lib/teaspoon/engine.rb +32 -16
- data/lib/teaspoon/environment.rb +28 -28
- data/lib/teaspoon/exceptions.rb +7 -7
- data/lib/teaspoon/exporter.rb +23 -23
- data/lib/teaspoon/formatter/base.rb +64 -46
- data/lib/teaspoon/formatter/clean.rb +2 -2
- data/lib/teaspoon/formatter/documentation.rb +40 -40
- data/lib/teaspoon/formatter/dot.rb +12 -12
- data/lib/teaspoon/formatter/json.rb +21 -21
- data/lib/teaspoon/formatter/junit.rb +52 -51
- data/lib/teaspoon/formatter/modules/report_module.rb +34 -32
- data/lib/teaspoon/formatter/pride.rb +21 -21
- data/lib/teaspoon/formatter/rspec_html.rb +31 -31
- data/lib/teaspoon/formatter/snowday.rb +6 -5
- data/lib/teaspoon/formatter/swayze_or_oprah.rb +91 -91
- data/lib/teaspoon/formatter/tap.rb +29 -29
- data/lib/teaspoon/formatter/tap_y.rb +57 -57
- data/lib/teaspoon/formatter/teamcity.rb +63 -63
- data/lib/teaspoon/framework/base.rb +1 -1
- data/lib/teaspoon/instrumentation.rb +18 -18
- data/lib/teaspoon/registry.rb +9 -9
- data/lib/teaspoon/registry/has_default.rb +2 -2
- data/lib/teaspoon/runner.rb +37 -37
- data/lib/teaspoon/server.rb +30 -29
- data/lib/teaspoon/suite.rb +68 -57
- data/lib/teaspoon/utility.rb +6 -0
- data/lib/teaspoon/version.rb +1 -1
- metadata +10 -17
- data/lib/teaspoon/driver/capybara_webkit.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 87a2167152fd03a542d32f164a5dfb521f6db314a553d8d8b6f108efab669635
|
4
|
+
data.tar.gz: 2e8fad35367a9d663adc6d220f2a65c768b00c8742fea7b5acd0b3e522539b17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdb23553e3231e9afc7848dc4bd2f7237e50888ea77118f3fb5f27c4c216c1743bab2a1b14fd5c16f0fb267442da61d4a9dc96b60bb8337236e15a63b2084d16
|
7
|
+
data.tar.gz: 07f1907cfc1592fed2c314a06efa79c7e41cd744c5b7a1600c39ffc4a00e13bc303dda559bc53d73b65c8b6021004d85fbd5854c137cdf1eb77d4105e55c0f65
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,54 @@
|
|
1
1
|
### Unreleased
|
2
2
|
|
3
|
+
### 1.2.1
|
4
|
+
|
5
|
+
* require utility in console to get Teaspoon.root (#562)
|
6
|
+
* Update ruby version requirement to allow ruby 3.0 (#583)
|
7
|
+
* Fix coverage output path (#579)
|
8
|
+
* Delay using Rails until loaded (#582)
|
9
|
+
* Run tests via Github Actions (#588)
|
10
|
+
|
11
|
+
### 1.2.0
|
12
|
+
|
13
|
+
#### Enhancements
|
14
|
+
|
15
|
+
* Add Rails 6 (beta1) support (#556)
|
16
|
+
* Allow passing selenium options (#537)
|
17
|
+
|
18
|
+
#### Bug Fixes
|
19
|
+
|
20
|
+
* Removes Rails 3 & 4 support (#560)
|
21
|
+
* Removes support for capybara webkit (#560)
|
22
|
+
* Fixes gem coffeescript assets being discovered by sprockets (#405)
|
23
|
+
* Many other small changes/fixes
|
24
|
+
|
25
|
+
### 1.1.5
|
26
|
+
|
27
|
+
#### Enhancements
|
28
|
+
|
29
|
+
* Adds support for Rails 5
|
30
|
+
|
3
31
|
#### Bug Fixes
|
4
32
|
|
33
|
+
* Fixes an ActionView version related issue.
|
34
|
+
* Changes before_filter to before_action where possible (Rails 3 vs. Rails 5)
|
35
|
+
|
36
|
+
|
37
|
+
### 1.1.4
|
38
|
+
|
39
|
+
#### Bug Fixes
|
40
|
+
|
41
|
+
* Fixes an ActionView version related issue.
|
42
|
+
|
43
|
+
|
44
|
+
### 1.1.3
|
45
|
+
|
46
|
+
This was an erroneous release, of the rails_5 branch. oops.
|
47
|
+
|
48
|
+
#### Bug Fixes
|
49
|
+
|
50
|
+
* Fix for version check of ActionView, to expand the version checking for security/bug fix releases.
|
51
|
+
|
5
52
|
|
6
53
|
### 1.1.2
|
7
54
|
|
data/MIT.LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
Copyright
|
1
|
+
Copyright 2019 Jeremy Jackson
|
2
2
|
|
3
|
-
https://github.com/
|
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
|
-
[![
|
6
|
-
[![
|
7
|
-
[![
|
8
|
-
[![
|
9
|
-
[![
|
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/
|
12
|
-
<sup>Logo by [Morgan Keys](
|
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
|
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
|
-
|
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/
|
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/
|
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/
|
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/
|
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
|
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/
|
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://
|
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/
|
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/
|
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/
|
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/
|
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](
|
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://
|
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/
|
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
|
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)
|
@@ -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()
|
@@ -1,6 +1,10 @@
|
|
1
1
|
class Teaspoon::SuiteController < ActionController::Base
|
2
|
-
|
3
|
-
|
2
|
+
def self.before(*args)
|
3
|
+
respond_to?(:before_action) ? before_action(*args) : before_filter(*args)
|
4
|
+
end
|
5
|
+
|
6
|
+
before :check_env
|
7
|
+
before :prepend_fixture_paths
|
4
8
|
|
5
9
|
layout false
|
6
10
|
|
@@ -14,8 +18,13 @@ class Teaspoon::SuiteController < ActionController::Base
|
|
14
18
|
|
15
19
|
def hook
|
16
20
|
hooks = Teaspoon::Suite.new(params).hooks[params[:hook].to_s]
|
17
|
-
|
18
|
-
|
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
|
19
28
|
end
|
20
29
|
|
21
30
|
def fixtures
|
@@ -24,13 +33,18 @@ class Teaspoon::SuiteController < ActionController::Base
|
|
24
33
|
|
25
34
|
private
|
26
35
|
|
27
|
-
|
28
|
-
|
29
|
-
|
36
|
+
def check_env
|
37
|
+
Teaspoon::Environment.check_env!
|
38
|
+
end
|
30
39
|
|
31
|
-
|
32
|
-
|
33
|
-
|
40
|
+
def prepend_fixture_paths
|
41
|
+
Teaspoon.configuration.fixture_paths.each do |path|
|
42
|
+
prepend_view_path Teaspoon.configuration.root.join(path)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def hook_params(params)
|
47
|
+
return params.permit!.to_h if params.respond_to?(:permit!)
|
48
|
+
params
|
34
49
|
end
|
35
|
-
end
|
36
50
|
end
|
@@ -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/
|
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
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
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
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
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
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
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
|
-
|
99
|
-
|
100
|
-
|
98
|
+
def version
|
99
|
+
@version ||= options[:version] ? determine_requested_version : framework.versions.last
|
100
|
+
end
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
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
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
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
|