teaspoon 0.9.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +141 -0
- data/README.md +9 -19
- data/{vendor → app}/assets/javascripts/support/bind-poly.js +0 -0
- data/{vendor → app}/assets/javascripts/support/sinon.js +0 -0
- data/app/assets/javascripts/teaspoon-filterer.js +55 -0
- data/app/assets/javascripts/teaspoon/error.coffee +5 -0
- data/app/assets/javascripts/teaspoon/{base/fixture.coffee → fixture.coffee} +15 -15
- data/app/assets/javascripts/teaspoon/{base/hook.coffee → hook.coffee} +0 -0
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/console.coffee +18 -10
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html.coffee +43 -40
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/base_view.coffee +0 -0
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/failure_view.coffee +2 -0
- data/app/assets/javascripts/teaspoon/reporters/html/progress_view.coffee +18 -0
- data/app/assets/javascripts/teaspoon/{base/reporters/html/progress_view.coffee → reporters/html/radial_progress_view.coffee} +1 -34
- data/app/assets/javascripts/teaspoon/reporters/html/simple_progress_view.coffee +15 -0
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/spec_view.coffee +5 -3
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/suite_view.coffee +4 -2
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/template.coffee +0 -0
- data/app/assets/javascripts/teaspoon/{base/runner.coffee → runner.coffee} +7 -3
- data/app/assets/javascripts/teaspoon/teaspoon.coffee +90 -32
- data/app/controllers/teaspoon/suite_controller.rb +5 -0
- data/app/views/teaspoon/suite/index.html.erb +1 -1
- data/lib/generators/teaspoon/install/install_generator.rb +67 -37
- data/lib/generators/teaspoon/install/templates/MISSING_FRAMEWORK +14 -0
- data/lib/generators/teaspoon/install/{POST_INSTALL → templates/POST_INSTALL} +0 -0
- data/lib/generators/teaspoon/install/templates/env.rb.tt +14 -0
- data/lib/generators/teaspoon/install/templates/{jasmine/env_comments.rb.tt → env_comments.rb.tt} +34 -43
- data/lib/tasks/teaspoon/info.rake +17 -0
- data/lib/teaspoon-devkit.rb +61 -0
- data/lib/teaspoon.rb +2 -0
- data/lib/teaspoon/command_line.rb +19 -14
- data/lib/teaspoon/configuration.rb +24 -35
- data/lib/teaspoon/console.rb +11 -21
- data/lib/teaspoon/coverage.rb +14 -7
- data/lib/teaspoon/deprecated.rb +22 -4
- data/lib/teaspoon/driver.rb +15 -0
- data/lib/teaspoon/driver/base.rb +7 -0
- data/lib/teaspoon/{drivers/capybara_webkit_driver.rb → driver/capybara_webkit.rb} +8 -5
- data/lib/teaspoon/{drivers/phantomjs_driver.rb → driver/phantomjs.rb} +8 -4
- data/lib/teaspoon/{drivers → driver}/phantomjs/runner.js +0 -0
- data/lib/teaspoon/{drivers/selenium_driver.rb → driver/selenium.rb} +11 -9
- data/lib/teaspoon/engine.rb +38 -25
- data/lib/teaspoon/environment.rb +24 -15
- data/lib/teaspoon/exceptions.rb +154 -41
- data/lib/teaspoon/exporter.rb +2 -2
- data/lib/teaspoon/formatter.rb +30 -0
- data/lib/teaspoon/{formatters → formatter}/base.rb +2 -36
- data/lib/teaspoon/{formatters/clean_formatter.rb → formatter/clean.rb} +4 -2
- data/lib/teaspoon/{formatters/documentation_formatter.rb → formatter/documentation.rb} +4 -3
- data/lib/teaspoon/{formatters/dot_formatter.rb → formatter/dot.rb} +4 -3
- data/lib/teaspoon/{formatters/json_formatter.rb → formatter/json.rb} +4 -2
- data/lib/teaspoon/{formatters/junit_formatter.rb → formatter/junit.rb} +3 -2
- data/lib/teaspoon/{formatters → formatter}/modules/report_module.rb +1 -1
- data/lib/teaspoon/{formatters/pride_formatter.rb → formatter/pride.rb} +4 -2
- data/lib/teaspoon/{formatters/rspec_html_formatter.rb → formatter/rspec_html.rb} +3 -2
- data/lib/teaspoon/{formatters/snowday_formatter.rb → formatter/snowday.rb} +3 -2
- data/lib/teaspoon/formatter/swayze_or_oprah.rb +111 -0
- data/lib/teaspoon/{formatters/tap_formatter.rb → formatter/tap.rb} +4 -2
- data/lib/teaspoon/{formatters/tap_y_formatter.rb → formatter/tap_y.rb} +3 -2
- data/lib/teaspoon/{formatters/teamcity_formatter.rb → formatter/teamcity.rb} +4 -2
- data/lib/teaspoon/framework.rb +17 -0
- data/lib/teaspoon/framework/base.rb +88 -0
- data/lib/teaspoon/instrumentation.rb +12 -2
- data/lib/teaspoon/registry.rb +47 -0
- data/lib/teaspoon/registry/has_default.rb +11 -0
- data/lib/teaspoon/runner.rb +6 -7
- data/lib/teaspoon/server.rb +2 -2
- data/lib/teaspoon/suite.rb +28 -30
- data/lib/teaspoon/utility.rb +5 -0
- data/lib/teaspoon/version.rb +1 -1
- metadata +52 -276
- data/app/assets/javascripts/teaspoon-jasmine.js +0 -1344
- data/app/assets/javascripts/teaspoon-mocha.js +0 -1350
- data/app/assets/javascripts/teaspoon-qunit.js +0 -1415
- data/app/assets/javascripts/teaspoon-teaspoon.js +0 -51
- data/app/assets/javascripts/teaspoon/base/teaspoon.coffee +0 -69
- data/app/assets/javascripts/teaspoon/jasmine.coffee +0 -119
- data/app/assets/javascripts/teaspoon/jasmine/reporters/html.coffee +0 -11
- data/app/assets/javascripts/teaspoon/mocha.coffee +0 -90
- data/app/assets/javascripts/teaspoon/mocha/reporters/console.coffee +0 -16
- data/app/assets/javascripts/teaspoon/mocha/reporters/html.coffee +0 -27
- data/app/assets/javascripts/teaspoon/qunit.coffee +0 -81
- data/app/assets/javascripts/teaspoon/qunit/reporters/console.coffee +0 -25
- data/app/assets/javascripts/teaspoon/qunit/reporters/html.coffee +0 -80
- data/lib/generators/teaspoon/install/templates/jasmine/env.rb +0 -11
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +0 -31
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +0 -31
- data/lib/generators/teaspoon/install/templates/mocha/env.rb +0 -11
- data/lib/generators/teaspoon/install/templates/mocha/env_comments.rb.tt +0 -187
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +0 -40
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +0 -40
- data/lib/generators/teaspoon/install/templates/qunit/env.rb +0 -11
- data/lib/generators/teaspoon/install/templates/qunit/env_comments.rb.tt +0 -187
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +0 -29
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +0 -30
- data/lib/teaspoon/drivers/base.rb +0 -10
- data/lib/teaspoon/formatters/description.rb +0 -36
- data/lib/teaspoon/formatters/swayze_or_oprah_formatter.rb +0 -101
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/assets/javascripts/instrumented1.coffee +0 -1
- data/spec/dummy/app/assets/javascripts/instrumented2.coffee +0 -1
- data/spec/dummy/app/assets/javascripts/integration/integration.coffee +0 -1
- data/spec/dummy/app/assets/javascripts/integration/integration_spec.coffee +0 -32
- data/spec/dummy/app/assets/javascripts/integration/spec_helper.coffee +0 -7
- data/spec/dummy/app/assets/javascripts/specs/asset_spec.js +0 -11
- data/spec/dummy/config.ru +0 -15
- data/spec/dummy/config/application.rb +0 -29
- data/spec/dummy/config/boot.rb +0 -3
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -41
- data/spec/dummy/config/environments/production.rb +0 -79
- data/spec/dummy/config/environments/test.rb +0 -42
- data/spec/dummy/config/routes.rb +0 -2
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +0 -6
- data/spec/features/console_reporter_spec.rb +0 -62
- data/spec/features/hooks_spec.rb +0 -60
- data/spec/features/html_reporter_spec.rb +0 -81
- data/spec/features/install_generator_spec.rb +0 -54
- data/spec/features/instrumentation_spec.rb +0 -21
- data/spec/fixtures/coverage.json +0 -243
- data/spec/javascripts/fixtures/_body.html.erb +0 -1
- data/spec/javascripts/fixtures/fixture.html.haml +0 -4
- data/spec/javascripts/fixtures/fixture.json +0 -4
- data/spec/javascripts/jasmine_helper.coffee +0 -3
- data/spec/javascripts/mocha_helper.coffee +0 -4
- data/spec/javascripts/spec_helper.coffee +0 -7
- data/spec/javascripts/stylesheets/stylesheet.css.scss +0 -0
- data/spec/javascripts/support/json2.js +0 -486
- data/spec/javascripts/support/support.js.coffee +0 -0
- data/spec/javascripts/teaspoon/base/fixture_spec.coffee +0 -93
- data/spec/javascripts/teaspoon/base/reporters/console_spec.coffee +0 -162
- data/spec/javascripts/teaspoon/base/reporters/html/base_view_spec.coffee +0 -88
- data/spec/javascripts/teaspoon/base/reporters/html/failure_view_spec.coffee +0 -28
- data/spec/javascripts/teaspoon/base/reporters/html/progress_view_spec.coffee +0 -1
- data/spec/javascripts/teaspoon/base/reporters/html/spec_view_spec.coffee +0 -1
- data/spec/javascripts/teaspoon/base/reporters/html/suite_view_spec.coffee +0 -1
- data/spec/javascripts/teaspoon/base/reporters/html_spec.coffee +0 -372
- data/spec/javascripts/teaspoon/base/runner_spec.coffee +0 -58
- data/spec/javascripts/teaspoon/base/teaspoon_spec.coffee +0 -47
- data/spec/javascripts/teaspoon/jasmine/fixture_jspec.coffee +0 -13
- data/spec/javascripts/teaspoon/jasmine/models_jspec.coffee +0 -101
- data/spec/javascripts/teaspoon/jasmine/reporters/html_jspec.coffee +0 -17
- data/spec/javascripts/teaspoon/jasmine/runner_jspec.coffee +0 -59
- data/spec/javascripts/teaspoon/jasmine/spec_jspec.coffee +0 -3
- data/spec/javascripts/teaspoon/mocha/fixture_mspec.coffee +0 -12
- data/spec/javascripts/teaspoon/mocha/models_mspec.coffee +0 -93
- data/spec/javascripts/teaspoon/mocha/reporters/console_mspec.coffee +0 -24
- data/spec/javascripts/teaspoon/mocha/reporters/html_mspec.coffee +0 -41
- data/spec/javascripts/teaspoon/mocha/runner_mspec.coffee +0 -23
- data/spec/javascripts/teaspoon/mocha/spec_mspec.coffee +0 -9
- data/spec/javascripts/teaspoon/other/erb_spec.js.coffee.erb +0 -4
- data/spec/javascripts/teaspoon/phantomjs/runner_spec.coffee +0 -161
- data/spec/javascripts/turbolinks_helper.coffee +0 -2
- data/spec/spec_helper.rb +0 -25
- data/spec/support/aruba.rb +0 -15
- data/spec/teaspoon/command_line_spec.rb +0 -157
- data/spec/teaspoon/configuration_spec.rb +0 -236
- data/spec/teaspoon/console_spec.rb +0 -224
- data/spec/teaspoon/coverage_spec.rb +0 -118
- data/spec/teaspoon/drivers/base_spec.rb +0 -5
- data/spec/teaspoon/drivers/capybara_webkit_driver_spec.rb +0 -39
- data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +0 -66
- data/spec/teaspoon/drivers/selenium_driver_spec.rb +0 -68
- data/spec/teaspoon/engine_spec.rb +0 -22
- data/spec/teaspoon/environment_spec.rb +0 -109
- data/spec/teaspoon/exceptions_spec.rb +0 -57
- data/spec/teaspoon/exporter_spec.rb +0 -96
- data/spec/teaspoon/formatters/base_spec.rb +0 -259
- data/spec/teaspoon/formatters/clean_formatter_spec.rb +0 -37
- data/spec/teaspoon/formatters/documentation_formatter_spec.rb +0 -127
- data/spec/teaspoon/formatters/dot_formatter_spec.rb +0 -116
- data/spec/teaspoon/formatters/json_formatter_spec.rb +0 -77
- data/spec/teaspoon/formatters/junit_formatter_spec.rb +0 -114
- data/spec/teaspoon/formatters/pride_formatter_spec.rb +0 -37
- data/spec/teaspoon/formatters/rspec_html_formatter_spec.rb +0 -107
- data/spec/teaspoon/formatters/snowday_formatter_spec.rb +0 -35
- data/spec/teaspoon/formatters/tap_formatter_spec.rb +0 -72
- data/spec/teaspoon/formatters/tap_y_formatter_spec.rb +0 -80
- data/spec/teaspoon/formatters/teamcity_formatter_spec.rb +0 -148
- data/spec/teaspoon/instrumentation_spec.rb +0 -113
- data/spec/teaspoon/result_spec.rb +0 -98
- data/spec/teaspoon/runner_spec.rb +0 -116
- data/spec/teaspoon/server_spec.rb +0 -105
- data/spec/teaspoon/suite_spec.rb +0 -138
- data/spec/teaspoon_env.rb +0 -39
- data/test/javascripts/qunit_helper.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/fixture_test.coffee +0 -10
- data/test/javascripts/teaspoon/qunit/models_test.coffee +0 -66
- data/test/javascripts/teaspoon/qunit/reporters/console_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/reporters/html/failure_view_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/reporters/html/spec_view_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/reporters/html/suite_view_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/reporters/html_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/runner_test.coffee +0 -18
- data/vendor/assets/javascripts/jasmine/1.3.1.js +0 -2602
- data/vendor/assets/javascripts/jasmine/2.0.0.js +0 -2412
- data/vendor/assets/javascripts/jasmine/MIT.LICENSE +0 -20
- data/vendor/assets/javascripts/mocha/1.10.0.js +0 -5374
- data/vendor/assets/javascripts/mocha/1.17.1.js +0 -5813
- data/vendor/assets/javascripts/mocha/MIT.LICENSE +0 -22
- data/vendor/assets/javascripts/qunit/1.12.0.js +0 -2212
- data/vendor/assets/javascripts/qunit/1.14.0.js +0 -2288
- data/vendor/assets/javascripts/qunit/MIT.LICENSE +0 -21
- data/vendor/assets/javascripts/support/chai-1.10.0.js +0 -4800
- data/vendor/assets/javascripts/support/chai-jq-0.0.7.js +0 -524
- data/vendor/assets/javascripts/support/chai.js +0 -4782
- data/vendor/assets/javascripts/support/expect.js +0 -1284
- data/vendor/assets/javascripts/support/jasmine-jquery-1.7.0.js +0 -720
- data/vendor/assets/javascripts/support/jasmine-jquery-2.0.0.js +0 -812
- data/vendor/assets/javascripts/support/sinon-chai.js +0 -126
@@ -0,0 +1,14 @@
|
|
1
|
+
******************************************************************************
|
2
|
+
Error: There don't seem to be any frameworks registered within Teaspoon yet.
|
3
|
+
|
4
|
+
Teaspoon has been split into separate gems so you can now include only the
|
5
|
+
javascript frameworks you want.
|
6
|
+
|
7
|
+
Add one or more of the following to your gemfile:
|
8
|
+
|
9
|
+
gem "teaspoon-jasmine"
|
10
|
+
gem "teaspoon-mocha"
|
11
|
+
gem "teaspoon-qunit"
|
12
|
+
|
13
|
+
More information can be found at: https://github.com/modeset/teaspoon
|
14
|
+
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Teaspoon.configure do |config|
|
2
|
+
config.mount_at = "/teaspoon"
|
3
|
+
config.root = nil
|
4
|
+
config.asset_paths = ["<%= framework.install_path %>/javascripts", "<%= framework.install_path %>/javascripts/stylesheets"]
|
5
|
+
config.fixture_paths = ["<%= framework.install_path %>/javascripts/fixtures"]
|
6
|
+
|
7
|
+
config.suite do |suite|
|
8
|
+
suite.use_framework :<%= framework.name %>, <%= version.inspect %> # <%= framework.versions.join(', ') %>
|
9
|
+
suite.matcher = <%= suite.matcher.inspect %>
|
10
|
+
suite.helper = <%= suite.helper.inspect %>
|
11
|
+
suite.boot_partial = <%= suite.boot_partial.inspect %>
|
12
|
+
suite.body_partial = <%= suite.body_partial.inspect %>
|
13
|
+
end
|
14
|
+
end
|
data/lib/generators/teaspoon/install/templates/{jasmine/env_comments.rb.tt → env_comments.rb.tt}
RENAMED
@@ -1,27 +1,20 @@
|
|
1
|
-
# Set RAILS_ROOT and load the environment if it's not already loaded.
|
2
|
-
unless defined?(Rails)
|
3
|
-
ENV["RAILS_ROOT"] = File.expand_path("../../", __FILE__)
|
4
|
-
require File.expand_path("../../config/environment", __FILE__)
|
5
|
-
end
|
6
|
-
|
7
1
|
Teaspoon.configure do |config|
|
8
|
-
|
9
2
|
# Determines where the Teaspoon routes will be mounted. Changing this to "/jasmine" would allow you to browse to
|
10
3
|
# `http://localhost:3000/jasmine` to run your tests.
|
11
|
-
|
4
|
+
config.mount_at = "/teaspoon"
|
12
5
|
|
13
6
|
# Specifies the root where Teaspoon will look for files. If you're testing an engine using a dummy application it can
|
14
7
|
# be useful to set this to your engines root (e.g. `Teaspoon::Engine.root`).
|
15
8
|
# Note: Defaults to `Rails.root` if nil.
|
16
|
-
|
9
|
+
config.root = nil
|
17
10
|
|
18
11
|
# Paths that will be appended to the Rails assets paths
|
19
12
|
# Note: Relative to `config.root`.
|
20
|
-
|
13
|
+
config.asset_paths = ["<%= framework.install_path %>/javascripts", "<%= framework.install_path %>/javascripts/stylesheets"]
|
21
14
|
|
22
15
|
# Fixtures are rendered through a controller, which allows using HAML, RABL/JBuilder, etc. Files in these paths will
|
23
16
|
# be rendered as fixtures.
|
24
|
-
|
17
|
+
config.fixture_paths = ["<%= framework.install_path %>/javascripts/fixtures"]
|
25
18
|
|
26
19
|
# SUITES
|
27
20
|
#
|
@@ -35,62 +28,52 @@ Teaspoon.configure do |config|
|
|
35
28
|
# - with the rake task: rake teaspoon suite=[suite_name]
|
36
29
|
# - with the cli: teaspoon --suite=[suite_name]
|
37
30
|
config.suite do |suite|
|
38
|
-
|
39
31
|
# Specify the framework you would like to use. This allows you to select versions, and will do some basic setup for
|
40
32
|
# you -- which you can override with the directives below. This should be specified first, as it can override other
|
41
33
|
# directives.
|
42
34
|
# Note: If no version is specified, the latest is assumed.
|
43
35
|
#
|
44
|
-
#
|
45
|
-
suite.use_framework
|
36
|
+
# Versions: <%= framework.versions.join(', ') %>
|
37
|
+
suite.use_framework :<%= framework.name %>, <%= version.inspect %>
|
46
38
|
|
47
39
|
# Specify a file matcher as a regular expression and all matching files will be loaded when the suite is run. These
|
48
40
|
# files need to be within an asset path. You can add asset paths using the `config.asset_paths`.
|
49
|
-
|
50
|
-
|
51
|
-
# This suites spec helper, which can require additional support files. This file is loaded before any of your test
|
52
|
-
# files are loaded.
|
53
|
-
#suite.helper = "spec_helper"
|
41
|
+
suite.matcher = <%= suite.matcher.inspect %>
|
54
42
|
|
55
|
-
#
|
56
|
-
#
|
57
|
-
# Note: For CoffeeScript files use `"teaspoon/jasmine"` etc.
|
58
|
-
#
|
59
|
-
# Available: teaspoon-jasmine, teaspoon-mocha, teaspoon-qunit
|
60
|
-
#suite.javascripts = ["jasmine/1.3.1", "teaspoon-jasmine"]
|
43
|
+
# Load additional JS files, but requiring them in your spec helper is the preferred way to do this.
|
44
|
+
#suite.javascripts = []
|
61
45
|
|
62
46
|
# You can include your own stylesheets if you want to change how Teaspoon looks.
|
63
47
|
# Note: Spec related CSS can and should be loaded using fixtures.
|
64
48
|
#suite.stylesheets = ["teaspoon"]
|
65
49
|
|
50
|
+
# This suites spec helper, which can require additional support files. This file is loaded before any of your test
|
51
|
+
# files are loaded.
|
52
|
+
suite.helper = <%= suite.helper.inspect %>
|
53
|
+
|
66
54
|
# Partial to be rendered in the head tag of the runner. You can use the provided ones or define your own by creating
|
67
55
|
# a `_boot.html.erb` in your fixtures path, and adjust the config to `"/boot"` for instance.
|
68
56
|
#
|
69
57
|
# Available: boot, boot_require_js
|
70
|
-
|
58
|
+
suite.boot_partial = <%= suite.boot_partial.inspect %>
|
71
59
|
|
72
60
|
# Partial to be rendered in the body tag of the runner. You can define your own to create a custom body structure.
|
73
|
-
|
74
|
-
|
75
|
-
# Assets to be ignored when generating coverage reports. Accepts an array of filenames or regular expressions. The
|
76
|
-
# default excludes assets from vendor, gems and support libraries.<br/><br/>
|
77
|
-
#suite.no_coverage = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}]
|
61
|
+
suite.body_partial = <%= suite.body_partial.inspect %>
|
78
62
|
|
79
63
|
# Hooks allow you to use `Teaspoon.hook("fixtures")` before, after, or during your spec run. This will make a
|
80
64
|
# synchronous Ajax request to the server that will call all of the blocks you've defined for that hook name.
|
81
|
-
#suite.hook :fixtures, proc{
|
65
|
+
#suite.hook :fixtures, &proc{}
|
82
66
|
|
83
67
|
# Determine whether specs loaded into the test harness should be embedded as individual script tags or concatenated
|
84
68
|
# into a single file. Similar to Rails' asset `debug: true` and `config.assets.debug = true` options. By default,
|
85
69
|
# Teaspoon expands all assets to provide more valuable stack traces that reference individual source files.
|
86
|
-
#suite.expand_assets =
|
87
|
-
|
70
|
+
#suite.expand_assets = true
|
88
71
|
end
|
89
72
|
|
90
73
|
# Example suite. Since we're just filtering to files already within the root test/javascripts, these files will also
|
91
74
|
# be run in the default suite -- but can be focused into a more specific suite.
|
92
75
|
#config.suite :targeted do |suite|
|
93
|
-
# suite.matcher = "
|
76
|
+
# suite.matcher = "<%= framework.install_path %>/javascripts/targeted/*_spec.{js,js.coffee,coffee}"
|
94
77
|
#end
|
95
78
|
|
96
79
|
# CONSOLE RUNNER SPECIFIC
|
@@ -107,15 +90,17 @@ Teaspoon.configure do |config|
|
|
107
90
|
|
108
91
|
# Specify which headless driver to use. Supports PhantomJS and Selenium Webdriver.
|
109
92
|
#
|
110
|
-
# Available:
|
93
|
+
# Available: <%= Teaspoon::Driver.available.keys.map{|f| ":#{f}"}.join(", ") %>
|
111
94
|
# PhantomJS: https://github.com/modeset/teaspoon/wiki/Using-PhantomJS
|
112
95
|
# Selenium Webdriver: https://github.com/modeset/teaspoon/wiki/Using-Selenium-WebDriver
|
113
|
-
#
|
96
|
+
# Capybara Webkit: https://github.com/modeset/teaspoon/wiki/Using-Capybara-Webkit
|
97
|
+
#config.driver = :<%= Teaspoon::Driver.default %>
|
114
98
|
|
115
99
|
# Specify additional options for the driver.
|
116
100
|
#
|
117
101
|
# PhantomJS: https://github.com/modeset/teaspoon/wiki/Using-PhantomJS
|
118
102
|
# Selenium Webdriver: https://github.com/modeset/teaspoon/wiki/Using-Selenium-WebDriver
|
103
|
+
# Capybara Webkit: https://github.com/modeset/teaspoon/wiki/Using-Capybara-Webkit
|
119
104
|
#config.driver_options = nil
|
120
105
|
|
121
106
|
# Specify the timeout for the driver. Specs are expected to complete within this time frame or the run will be
|
@@ -139,8 +124,8 @@ Teaspoon.configure do |config|
|
|
139
124
|
# Specify the formatters to use when outputting the results.
|
140
125
|
# Note: Output files can be specified by using `"junit>/path/to/output.xml"`.
|
141
126
|
#
|
142
|
-
# Available: <%= Teaspoon::
|
143
|
-
#config.formatters = [
|
127
|
+
# Available: <%= Teaspoon::Formatter.available.keys.map{|f| ":#{f}"}.join(", ") %>
|
128
|
+
#config.formatters = [:<%= Teaspoon::Formatter.default %>]
|
144
129
|
|
145
130
|
# Specify if you want color output from the formatters.
|
146
131
|
#config.color = true
|
@@ -161,11 +146,15 @@ Teaspoon.configure do |config|
|
|
161
146
|
# - with the rake task: rake teaspoon USE_COVERAGE=[coverage_name]
|
162
147
|
# - with the cli: teaspoon --coverage=[coverage_name]
|
163
148
|
|
164
|
-
# Specify that you always want a coverage configuration to be used.
|
149
|
+
# Specify that you always want a coverage configuration to be used. Otherwise, specify that you want coverage
|
150
|
+
# on the CLI.
|
151
|
+
# Set this to "true" or the name of your coverage config.
|
165
152
|
#config.use_coverage = nil
|
166
153
|
|
154
|
+
# You can have multiple coverage configs by passing a name to config.coverage.
|
155
|
+
# e.g. config.coverage :ci do |coverage|
|
156
|
+
# The default coverage config name is :default.
|
167
157
|
config.coverage do |coverage|
|
168
|
-
|
169
158
|
# Which coverage reports Istanbul should generate. Correlates directly to what Istanbul supports.
|
170
159
|
#
|
171
160
|
# Available: text-summary, text, html, lcov, lcovonly, cobertura, teamcity
|
@@ -175,13 +164,15 @@ Teaspoon.configure do |config|
|
|
175
164
|
# Note: Relative to `config.root`.
|
176
165
|
#coverage.output_path = "coverage"
|
177
166
|
|
167
|
+
# Assets to be ignored when generating coverage reports. Accepts an array of filenames or regular expressions. The
|
168
|
+
# default excludes assets from vendor, gems and support libraries.
|
169
|
+
#coverage.ignore = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}]
|
170
|
+
|
178
171
|
# Various thresholds requirements can be defined, and those thresholds will be checked at the end of a run. If any
|
179
172
|
# aren't met the run will fail with a message. Thresholds can be defined as a percentage (0-100), or nil.
|
180
173
|
#coverage.statements = nil
|
181
174
|
#coverage.functions = nil
|
182
175
|
#coverage.branches = nil
|
183
176
|
#coverage.lines = nil
|
184
|
-
|
185
177
|
end
|
186
|
-
|
187
178
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
namespace :teaspoon do
|
2
|
+
desc "Print teaspoon and framework information"
|
3
|
+
task info: :environment do
|
4
|
+
STDOUT.print("Teaspoon: #{Teaspoon::VERSION}\n\n")
|
5
|
+
|
6
|
+
STDOUT.print("Frameworks:\n")
|
7
|
+
|
8
|
+
Teaspoon::Framework.available.each do |framework, _|
|
9
|
+
STDOUT.print(" #{framework}\n")
|
10
|
+
|
11
|
+
versions = Teaspoon::Framework.fetch(framework).versions
|
12
|
+
versions.each { |version| STDOUT.print(" #{version}\n") }
|
13
|
+
|
14
|
+
STDOUT.print("\n")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Teaspoon
|
2
|
+
DEV_PATH = File.expand_path("../../", __FILE__)
|
3
|
+
SPEC_HELPER = File.join(DEV_PATH, "spec", "spec_helper")
|
4
|
+
FIXTURE_PATH = File.join(DEV_PATH, "spec", "javascripts", "fixtures")
|
5
|
+
RAKEFILE = File.join(DEV_PATH, "Rakefile")
|
6
|
+
|
7
|
+
def self.require_dummy!
|
8
|
+
unless defined?(Rails)
|
9
|
+
ENV["RAILS_ROOT"] = File.join(DEV_PATH, "spec", "dummy")
|
10
|
+
require File.join(ENV["RAILS_ROOT"], "config", "environment")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.loaded_from_teaspoon_root?
|
15
|
+
Dir.pwd == DEV_PATH
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.load_teaspoon_tasks
|
19
|
+
if !loaded_from_teaspoon_root?
|
20
|
+
load File.join(RAKEFILE)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.setup_framework_tasks(framework:, framework_name:, framework_const:, framework_root:, compile_assets:)
|
25
|
+
extend Rake::DSL
|
26
|
+
|
27
|
+
namespace :teaspoon do
|
28
|
+
namespace framework do
|
29
|
+
desc "Run the #{framework_name} code examples"
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
31
|
+
t.pattern = File.expand_path("spec/**/*_spec.rb", framework_root)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
namespace framework do
|
36
|
+
desc "Builds Teaspoon #{framework_name} into the distribution ready bundle"
|
37
|
+
task build: "#{framework}:build:javascripts"
|
38
|
+
|
39
|
+
namespace :build do
|
40
|
+
desc "Compile Teaspoon #{framework_name} coffeescripts into javacripts"
|
41
|
+
task javascripts: :environment do
|
42
|
+
env = Rails.application.assets
|
43
|
+
|
44
|
+
Array(compile_assets).each do |filename|
|
45
|
+
asset = env.find_asset("teaspoon/#{filename}")
|
46
|
+
base_destination = framework_const.asset_paths.first
|
47
|
+
asset.write_to(File.expand_path("teaspoon-#{filename}", base_destination))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
if !loaded_from_teaspoon_root?
|
55
|
+
Rake::Task["default"].prerequisites.clear
|
56
|
+
Rake::Task["default"].clear
|
57
|
+
|
58
|
+
task default: "teaspoon:#{framework}:spec"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/teaspoon.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
require "optparse"
|
2
2
|
require "teaspoon/version"
|
3
3
|
require "teaspoon/exceptions"
|
4
|
-
require "teaspoon/
|
4
|
+
require "teaspoon/utility"
|
5
|
+
require "teaspoon/driver"
|
6
|
+
require "teaspoon/formatter"
|
5
7
|
|
6
8
|
module Teaspoon
|
7
9
|
class CommandLine
|
@@ -10,9 +12,9 @@ module Teaspoon
|
|
10
12
|
@options[:files] = opt_parser.parse!
|
11
13
|
|
12
14
|
require_console
|
13
|
-
abort if Teaspoon::Console.new(@options).failures?
|
15
|
+
Teaspoon.abort(nil, 1) if Teaspoon::Console.new(@options).failures?
|
14
16
|
rescue Teaspoon::EnvironmentNotFound => e
|
15
|
-
abort("#{e.message}
|
17
|
+
Teaspoon.abort("#{e.message} Consider using --require=path/to/teaspoon_env.rb")
|
16
18
|
end
|
17
19
|
|
18
20
|
def opt_parser
|
@@ -40,9 +42,7 @@ module Teaspoon
|
|
40
42
|
|
41
43
|
opt :driver, "-d", "--driver DRIVER",
|
42
44
|
"Specify driver:",
|
43
|
-
|
44
|
-
" selenium",
|
45
|
-
" capybara_webkit"
|
45
|
+
*driver_details
|
46
46
|
|
47
47
|
opt :driver_options, "--driver-options OPTIONS",
|
48
48
|
"Specify driver-specific options to pass into the driver.",
|
@@ -90,7 +90,7 @@ module Teaspoon
|
|
90
90
|
|
91
91
|
opt :formatters, "-f", "--format FORMATTERS",
|
92
92
|
"Specify formatters (comma separated)",
|
93
|
-
*
|
93
|
+
*formatter_details
|
94
94
|
end
|
95
95
|
|
96
96
|
def opts_for_coverage
|
@@ -104,13 +104,11 @@ module Teaspoon
|
|
104
104
|
separator("Utility")
|
105
105
|
|
106
106
|
@parser.on "-v", "--version", "Display the version." do
|
107
|
-
|
108
|
-
exit
|
107
|
+
Teaspoon.abort(Teaspoon::VERSION, 0)
|
109
108
|
end
|
110
109
|
|
111
110
|
@parser.on "-h", "--help", "You're looking at it." do
|
112
|
-
|
113
|
-
exit
|
111
|
+
Teaspoon.abort(@parser, 0)
|
114
112
|
end
|
115
113
|
end
|
116
114
|
|
@@ -128,9 +126,16 @@ module Teaspoon
|
|
128
126
|
require "teaspoon/console"
|
129
127
|
end
|
130
128
|
|
131
|
-
def
|
132
|
-
|
133
|
-
|
129
|
+
def formatter_details
|
130
|
+
Teaspoon::Formatter.available.map do |name, options|
|
131
|
+
" #{name}#{' (default)' if options[:default]} - #{options[:description]}"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def driver_details
|
136
|
+
Teaspoon::Driver.available.map do |name, options|
|
137
|
+
" #{name}#{' (default)' if options[:default]}"
|
138
|
+
end
|
134
139
|
end
|
135
140
|
end
|
136
141
|
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
require "singleton"
|
2
|
+
require "teaspoon/driver"
|
3
|
+
require "teaspoon/formatter"
|
2
4
|
|
3
5
|
module Teaspoon
|
4
|
-
autoload :Formatters, "teaspoon/formatters/base"
|
5
|
-
autoload :Drivers, "teaspoon/drivers/base"
|
6
|
-
|
7
6
|
class Configuration
|
8
7
|
include Singleton
|
9
8
|
|
@@ -16,18 +15,20 @@ module Teaspoon
|
|
16
15
|
# - add it to ENV_OVERRIDES if it can be overridden from ENV
|
17
16
|
# - add it to the initializers in /lib/generators/install/templates so it's documented there as well
|
18
17
|
|
19
|
-
cattr_accessor :mount_at, :root, :asset_paths, :fixture_paths
|
18
|
+
cattr_accessor :mount_at, :root, :asset_paths, :fixture_paths, :asset_manifest
|
20
19
|
@@mount_at = "/teaspoon"
|
21
20
|
@@root = nil # will default to Rails.root
|
22
|
-
@@asset_paths = ["spec/javascripts", "spec/javascripts/stylesheets",
|
21
|
+
@@asset_paths = ["spec/javascripts", "spec/javascripts/stylesheets",
|
22
|
+
"test/javascripts", "test/javascripts/stylesheets"]
|
23
23
|
@@fixture_paths = ["spec/javascripts/fixtures", "test/javascripts/fixtures"]
|
24
|
+
@@asset_manifest = ["teaspoon.css", "teaspoon-filterer.js", "teaspoon/*.js", "support/*.js"]
|
24
25
|
|
25
26
|
# console runner specific
|
26
27
|
|
27
28
|
cattr_accessor :driver, :driver_options, :driver_timeout, :server, :server_port, :server_timeout, :fail_fast,
|
28
29
|
:formatters, :color, :suppress_log,
|
29
30
|
:use_coverage
|
30
|
-
@@driver =
|
31
|
+
@@driver = Teaspoon::Driver.default
|
31
32
|
@@driver_options = nil
|
32
33
|
@@driver_timeout = 180
|
33
34
|
@@server = nil
|
@@ -35,7 +36,7 @@ module Teaspoon
|
|
35
36
|
@@server_timeout = 20
|
36
37
|
@@fail_fast = true
|
37
38
|
|
38
|
-
@@formatters = [
|
39
|
+
@@formatters = [Teaspoon::Formatter.default]
|
39
40
|
@@color = true
|
40
41
|
@@suppress_log = false
|
41
42
|
|
@@ -55,55 +56,42 @@ module Teaspoon
|
|
55
56
|
@@suite_configs = { "default" => { block: proc {} } }
|
56
57
|
|
57
58
|
def self.suite(name = :default, &block)
|
58
|
-
@@suite_configs[name.to_s] = { block: block, instance: Suite.new(&block) }
|
59
|
+
@@suite_configs[name.to_s] = { block: block, instance: Suite.new(name, &block) }
|
59
60
|
end
|
60
61
|
|
61
62
|
class Suite
|
62
|
-
FRAMEWORKS = {
|
63
|
-
jasmine: ["1.3.1", "2.0.0"],
|
64
|
-
mocha: ["1.10.0", "1.17.1"],
|
65
|
-
qunit: ["1.12.0", "1.14.0"],
|
66
|
-
}
|
67
|
-
|
68
63
|
attr_accessor :matcher, :helper, :javascripts, :stylesheets,
|
69
64
|
:boot_partial, :body_partial,
|
70
|
-
:
|
65
|
+
:hooks, :expand_assets
|
71
66
|
|
72
|
-
def initialize
|
67
|
+
def initialize(name = nil)
|
73
68
|
@matcher = "{spec/javascripts,app/assets}/**/*_spec.{js,js.coffee,coffee}"
|
74
69
|
@helper = "spec_helper"
|
75
|
-
@javascripts = [
|
70
|
+
@javascripts = []
|
76
71
|
@stylesheets = ["teaspoon"]
|
77
72
|
|
78
73
|
@boot_partial = "boot"
|
79
74
|
@body_partial = "body"
|
80
75
|
|
81
|
-
@no_coverage = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}]
|
82
76
|
@hooks = Hash.new { |h, k| h[k] = [] }
|
83
77
|
@expand_assets = true
|
84
78
|
|
85
79
|
default = Teaspoon.configuration.suite_configs["default"]
|
86
80
|
instance_eval(&default[:block]) if default
|
87
|
-
|
81
|
+
if block_given?
|
82
|
+
yield self
|
83
|
+
raise Teaspoon::UnspecifiedFramework.new(name: name) if @javascripts.length == 0
|
84
|
+
end
|
88
85
|
end
|
89
86
|
|
90
87
|
def use_framework(name, version = nil)
|
91
|
-
|
92
|
-
|
93
|
-
unless FRAMEWORKS[name] && FRAMEWORKS[name].include?(version)
|
94
|
-
message = "Unknown framework \"#{name}\""
|
95
|
-
if FRAMEWORKS[name] && version
|
96
|
-
message += " with version #{version} -- available versions #{FRAMEWORKS[name].join(', ')}"
|
97
|
-
end
|
98
|
-
raise Teaspoon::UnknownFramework, message
|
99
|
-
end
|
88
|
+
framework = Teaspoon::Framework.fetch(name)
|
89
|
+
framework.modify_config(self)
|
100
90
|
|
101
|
-
@javascripts =
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
@helper = "test_helper"
|
106
|
-
end
|
91
|
+
@javascripts = framework.javascripts_for(version)
|
92
|
+
return if @javascripts
|
93
|
+
|
94
|
+
raise Teaspoon::UnknownFrameworkVersion.new(name: name, version: version)
|
107
95
|
end
|
108
96
|
alias_method :use_framework=, :use_framework
|
109
97
|
|
@@ -122,12 +110,13 @@ module Teaspoon
|
|
122
110
|
end
|
123
111
|
|
124
112
|
class Coverage
|
125
|
-
attr_accessor :reports, :output_path,
|
113
|
+
attr_accessor :reports, :output_path, :ignore,
|
126
114
|
:statements, :functions, :branches, :lines
|
127
115
|
|
128
116
|
def initialize
|
129
117
|
@reports = ["text-summary"]
|
130
118
|
@output_path = "coverage"
|
119
|
+
@ignore = [%r{/.rvm/gems/}, %r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}]
|
131
120
|
|
132
121
|
@statements = nil
|
133
122
|
@functions = nil
|