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
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#= require teaspoon/reporters/html/base_view
|
2
|
+
|
3
|
+
class Teaspoon.Reporters.HTML.ProgressView extends Teaspoon.Reporters.BaseView
|
4
|
+
|
5
|
+
@create: (displayProgress = true) ->
|
6
|
+
return new Teaspoon.Reporters.HTML.ProgressView() unless displayProgress
|
7
|
+
if Teaspoon.Reporters.HTML.RadialProgressView.supported
|
8
|
+
new Teaspoon.Reporters.HTML.RadialProgressView()
|
9
|
+
else
|
10
|
+
new Teaspoon.Reporters.HTML.SimpleProgressView()
|
11
|
+
|
12
|
+
|
13
|
+
build: ->
|
14
|
+
@el = @createEl("div", "teaspoon-indicator teaspoon-logo")
|
15
|
+
|
16
|
+
|
17
|
+
update: ->
|
18
|
+
# do nothing
|
@@ -1,37 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
@create: (displayProgress = true) ->
|
4
|
-
return new Teaspoon.Reporters.HTML.ProgressView() unless displayProgress
|
5
|
-
if Teaspoon.Reporters.HTML.RadialProgressView.supported
|
6
|
-
new Teaspoon.Reporters.HTML.RadialProgressView()
|
7
|
-
else
|
8
|
-
new Teaspoon.Reporters.HTML.SimpleProgressView()
|
9
|
-
|
10
|
-
|
11
|
-
build: ->
|
12
|
-
@el = @createEl("div", "teaspoon-indicator teaspoon-logo")
|
13
|
-
|
14
|
-
|
15
|
-
update: ->
|
16
|
-
# do nothing
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
class Teaspoon.Reporters.HTML.SimpleProgressView extends Teaspoon.Reporters.HTML.ProgressView
|
21
|
-
|
22
|
-
build: ->
|
23
|
-
@el = @createEl("div", "simple-progress")
|
24
|
-
@el.innerHTML = """
|
25
|
-
<em id="teaspoon-progress-percent">0%</em>
|
26
|
-
<span id="teaspoon-progress-span" class="teaspoon-indicator"></span>
|
27
|
-
"""
|
28
|
-
|
29
|
-
|
30
|
-
update: (total, run) ->
|
31
|
-
percent = if total then Math.ceil((run * 100) / total) else 0
|
32
|
-
@setHtml("progress-percent", "#{percent}%")
|
33
|
-
|
34
|
-
|
1
|
+
#= require teaspoon/reporters/html/progress_view
|
35
2
|
|
36
3
|
class Teaspoon.Reporters.HTML.RadialProgressView extends Teaspoon.Reporters.HTML.ProgressView
|
37
4
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#= require teaspoon/reporters/html/progress_view
|
2
|
+
|
3
|
+
class Teaspoon.Reporters.HTML.SimpleProgressView extends Teaspoon.Reporters.HTML.ProgressView
|
4
|
+
|
5
|
+
build: ->
|
6
|
+
@el = @createEl("div", "simple-progress")
|
7
|
+
@el.innerHTML = """
|
8
|
+
<em id="teaspoon-progress-percent">0%</em>
|
9
|
+
<span id="teaspoon-progress-span" class="teaspoon-indicator"></span>
|
10
|
+
"""
|
11
|
+
|
12
|
+
|
13
|
+
update: (total, run) ->
|
14
|
+
percent = if total then Math.ceil((run * 100) / total) else 0
|
15
|
+
@setHtml("progress-percent", "#{percent}%")
|
@@ -1,3 +1,5 @@
|
|
1
|
+
#= require teaspoon/reporters/html/base_view
|
2
|
+
|
1
3
|
class Teaspoon.Reporters.HTML.SpecView extends Teaspoon.Reporters.BaseView
|
2
4
|
|
3
5
|
viewId = 0
|
@@ -23,7 +25,7 @@ class Teaspoon.Reporters.HTML.SpecView extends Teaspoon.Reporters.BaseView
|
|
23
25
|
if parent.viewId
|
24
26
|
@views.suites[parent.viewId]
|
25
27
|
else
|
26
|
-
view = new Teaspoon.Reporters.HTML.SuiteView(parent, @reporter)
|
28
|
+
view = new (Teaspoon.resolveClass("Reporters.HTML.SuiteView"))(parent, @reporter)
|
27
29
|
@views.suites[view.suite.viewId] = view
|
28
30
|
|
29
31
|
|
@@ -40,7 +42,7 @@ class Teaspoon.Reporters.HTML.SpecView extends Teaspoon.Reporters.BaseView
|
|
40
42
|
result = @spec.result()
|
41
43
|
classes = ["state-#{state}"]
|
42
44
|
classes.push("slow") if elapsed > Teaspoon.slow
|
43
|
-
@el.innerHTML += "<span>#{elapsed}ms</span>"
|
45
|
+
@el.innerHTML += "<span>#{elapsed}ms</span>" if state == "passed"
|
44
46
|
@el.className = classes.join(" ")
|
45
|
-
@buildErrors()
|
47
|
+
@buildErrors() if result.status == "failed"
|
46
48
|
@parentView.updateState?(state)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
#= require teaspoon/reporters/html/base_view
|
2
|
+
|
1
3
|
class Teaspoon.Reporters.HTML.SuiteView extends Teaspoon.Reporters.BaseView
|
2
4
|
|
3
5
|
viewId = 0
|
@@ -6,7 +8,7 @@ class Teaspoon.Reporters.HTML.SuiteView extends Teaspoon.Reporters.BaseView
|
|
6
8
|
@views = @reporter.views
|
7
9
|
@suite.viewId = viewId += 1
|
8
10
|
@views.suites[@suite.viewId] = @
|
9
|
-
@suite = new Teaspoon.Suite(@suite)
|
11
|
+
@suite = new (Teaspoon.resolveClass("Suite"))(@suite)
|
10
12
|
super
|
11
13
|
|
12
14
|
|
@@ -23,7 +25,7 @@ class Teaspoon.Reporters.HTML.SuiteView extends Teaspoon.Reporters.BaseView
|
|
23
25
|
if parent.viewId
|
24
26
|
@views.suites[parent.viewId]
|
25
27
|
else
|
26
|
-
view = new Teaspoon.Reporters.HTML.SuiteView(parent, @reporter)
|
28
|
+
view = new (Teaspoon.resolveClass("Reporters.HTML.SuiteView"))(parent, @reporter)
|
27
29
|
@views.suites[view.suite.viewId] = view
|
28
30
|
|
29
31
|
|
File without changes
|
@@ -20,13 +20,17 @@ class Teaspoon.Runner
|
|
20
20
|
|
21
21
|
getReporter: ->
|
22
22
|
if @params["reporter"]
|
23
|
-
|
23
|
+
@findReporter(@params["reporter"])
|
24
24
|
else
|
25
25
|
if window.navigator.userAgent.match(/PhantomJS/)
|
26
|
-
|
26
|
+
@findReporter("Console")
|
27
27
|
else
|
28
|
-
|
28
|
+
@findReporter("HTML")
|
29
29
|
|
30
30
|
|
31
31
|
setup: ->
|
32
32
|
# left for subclasses to implement
|
33
|
+
|
34
|
+
|
35
|
+
findReporter: (type) ->
|
36
|
+
Teaspoon.resolveClass("Reporters.#{type}")
|
@@ -1,32 +1,90 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
1
|
+
#= require_self
|
2
|
+
#= require teaspoon/runner
|
3
|
+
#= require teaspoon/fixture
|
4
|
+
#= require teaspoon/hook
|
5
|
+
#= require teaspoon/reporters/html
|
6
|
+
#= require teaspoon/reporters/console
|
7
|
+
|
8
|
+
class @Teaspoon
|
9
|
+
@defer: false
|
10
|
+
@slow: 75
|
11
|
+
@root: window.location.pathname.replace(/\/+(index\.html)?$/, "").replace(/\/[^\/]*$/, "")
|
12
|
+
@started: false
|
13
|
+
@finished: false
|
14
|
+
@Reporters: {}
|
15
|
+
@Date: Date
|
16
|
+
@location: window.location
|
17
|
+
@messages: []
|
18
|
+
|
19
|
+
@execute: ->
|
20
|
+
unless Teaspoon.framework
|
21
|
+
throw "No framework registered. Expected a framework to register itself, but nothing has."
|
22
|
+
|
23
|
+
if Teaspoon.defer
|
24
|
+
Teaspoon.defer = false
|
25
|
+
return
|
26
|
+
Teaspoon.reload() if Teaspoon.started
|
27
|
+
Teaspoon.started = true
|
28
|
+
new (Teaspoon.resolveClass("Runner"))()
|
29
|
+
|
30
|
+
|
31
|
+
@reload: ->
|
32
|
+
window.location.reload()
|
33
|
+
|
34
|
+
|
35
|
+
@onWindowLoad: (method) ->
|
36
|
+
originalOnload = window.onload
|
37
|
+
window.onload = ->
|
38
|
+
originalOnload() if originalOnload && originalOnload.call
|
39
|
+
method()
|
40
|
+
|
41
|
+
|
42
|
+
@resolveDependenciesFromParams: (all = []) ->
|
43
|
+
deps = []
|
44
|
+
return all if (paths = Teaspoon.location.search.match(/[\?&]file(\[\])?=[^&\?]*/gi)) == null
|
45
|
+
|
46
|
+
for path in paths
|
47
|
+
parts = decodeURIComponent(path.replace(/\+/g, " ")).match(/\/(.+)\.(js|js.coffee|coffee)$/i)
|
48
|
+
continue if parts == null
|
49
|
+
file = parts[1].substr(parts[1].lastIndexOf("/") + 1)
|
50
|
+
for dep in all then deps.push(dep) if dep.indexOf(file) >= 0
|
51
|
+
deps
|
52
|
+
|
53
|
+
|
54
|
+
@log: ->
|
55
|
+
Teaspoon.messages.push(arguments[0])
|
56
|
+
try console.log(arguments...)
|
57
|
+
catch e
|
58
|
+
throw new Error("Unable to use console.log for logging")
|
59
|
+
|
60
|
+
|
61
|
+
@getMessages: ->
|
62
|
+
messages = Teaspoon.messages
|
63
|
+
Teaspoon.messages = []
|
64
|
+
messages
|
65
|
+
|
66
|
+
|
67
|
+
@setFramework: (namespace) ->
|
68
|
+
Teaspoon.framework = namespace
|
69
|
+
window.fixture = Teaspoon.resolveClass("Fixture")
|
70
|
+
|
71
|
+
|
72
|
+
# This checks if a framework has overridden a core class and if we should
|
73
|
+
# load that instead of the core base class.
|
74
|
+
@resolveClass: (klass) ->
|
75
|
+
if framework_override = Teaspoon.checkNamespace(Teaspoon.framework, klass)
|
76
|
+
return framework_override
|
77
|
+
else if teaspoon_core = Teaspoon.checkNamespace(Teaspoon, klass)
|
78
|
+
return teaspoon_core
|
79
|
+
|
80
|
+
throw "Could not find the class you're looking for: #{klass}"
|
81
|
+
|
82
|
+
|
83
|
+
@checkNamespace: (root, klass) ->
|
84
|
+
namespaces = klass.split('.')
|
85
|
+
scope = root
|
86
|
+
|
87
|
+
for namespace, i in namespaces
|
88
|
+
return false if !(scope = scope[namespace])
|
89
|
+
|
90
|
+
return scope
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class Teaspoon::SuiteController < ActionController::Base
|
2
|
+
before_filter :check_env
|
2
3
|
before_filter :prepend_fixture_paths
|
3
4
|
|
4
5
|
layout false
|
@@ -23,6 +24,10 @@ class Teaspoon::SuiteController < ActionController::Base
|
|
23
24
|
|
24
25
|
private
|
25
26
|
|
27
|
+
def check_env
|
28
|
+
Teaspoon::Environment.check_env!
|
29
|
+
end
|
30
|
+
|
26
31
|
def prepend_fixture_paths
|
27
32
|
Teaspoon.configuration.fixture_paths.each do |path|
|
28
33
|
prepend_view_path Teaspoon.configuration.root.join(path)
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<title>Teaspoon :: Suites</title>
|
5
5
|
<meta name="viewport" content="width=device-width, user-scalable=no">
|
6
6
|
<%= stylesheet_link_tag "teaspoon" %>
|
7
|
-
<%= javascript_include_tag "teaspoon-
|
7
|
+
<%= javascript_include_tag "teaspoon-filterer" %>
|
8
8
|
</head>
|
9
9
|
<body>
|
10
10
|
<div id="teaspoon-interface">
|
@@ -1,88 +1,118 @@
|
|
1
|
+
require "teaspoon/exceptions"
|
2
|
+
require "rails/generators"
|
3
|
+
|
1
4
|
module Teaspoon
|
2
5
|
module Generators
|
3
6
|
class InstallGenerator < Rails::Generators::Base
|
4
|
-
source_root File.expand_path("../", __FILE__)
|
7
|
+
source_root File.expand_path("../templates", __FILE__)
|
5
8
|
|
6
9
|
desc "Installs the Teaspoon initializer into your application."
|
7
10
|
|
8
11
|
class_option :framework,
|
9
12
|
type: :string,
|
10
13
|
aliases: "-t",
|
11
|
-
default:
|
12
|
-
desc:
|
14
|
+
default: Teaspoon::Framework.default,
|
15
|
+
desc: "Specify which test framework to use (Available: #{Teaspoon::Framework.available.keys.join(', ')})"
|
16
|
+
|
17
|
+
class_option :version,
|
18
|
+
type: :string,
|
19
|
+
aliases: "-v",
|
20
|
+
default: nil,
|
21
|
+
desc: "Specify the framework version to use (Depends on the framework)"
|
13
22
|
|
14
23
|
class_option :coffee,
|
15
24
|
type: :boolean,
|
16
25
|
aliases: "-c",
|
17
26
|
default: false,
|
18
|
-
desc:
|
27
|
+
desc: "Generate a CoffeeScript spec helper instead of Javascript"
|
19
28
|
|
20
|
-
class_option :
|
29
|
+
class_option :documentation,
|
21
30
|
type: :boolean,
|
22
|
-
aliases: "-
|
23
|
-
default:
|
24
|
-
desc:
|
31
|
+
aliases: ["-d"],
|
32
|
+
default: true,
|
33
|
+
desc: "Install the teaspoon_env.rb with comment documentation"
|
25
34
|
|
26
35
|
class_option :partials,
|
27
36
|
type: :boolean,
|
28
37
|
aliases: "-p",
|
29
38
|
default: false,
|
30
|
-
desc:
|
39
|
+
desc: "Copy the boot and body partials"
|
31
40
|
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
-
|
41
|
+
def verify_framework_and_version
|
42
|
+
version.present?
|
43
|
+
framework
|
44
|
+
rescue
|
45
|
+
abort_with_message if behavior == :invoke
|
36
46
|
end
|
37
47
|
|
38
48
|
def copy_environment
|
39
|
-
|
40
|
-
|
41
|
-
"#{framework_type}/teaspoon_env.rb"
|
42
|
-
else
|
43
|
-
template "templates/#{framework}/env_comments.rb.tt",
|
44
|
-
"#{framework_type}/teaspoon_env.rb"
|
45
|
-
end
|
49
|
+
source = options[:documentation] ? "env_comments.rb.tt" : "env.rb.tt"
|
50
|
+
template source, "#{framework.install_path}/teaspoon_env.rb"
|
46
51
|
end
|
47
52
|
|
48
53
|
def create_structure
|
49
|
-
empty_directory "#{
|
50
|
-
empty_directory "#{
|
54
|
+
empty_directory "#{framework.install_path}/javascripts/support"
|
55
|
+
empty_directory "#{framework.install_path}/javascripts/fixtures"
|
51
56
|
end
|
52
57
|
|
53
|
-
def
|
54
|
-
|
55
|
-
"#{framework_type}/javascripts/#{framework_type}_helper.#{helper_ext}"
|
58
|
+
def install_framework_files
|
59
|
+
instance_eval(&framework.install_callback)
|
56
60
|
end
|
57
61
|
|
58
62
|
def copy_partials
|
59
63
|
return unless options[:partials]
|
60
|
-
copy_file "
|
61
|
-
|
62
|
-
copy_file "templates/_body.html.erb",
|
63
|
-
"#{framework_type}/javascripts/fixtures/_body.html.erb"
|
64
|
+
copy_file "_boot.html.erb", "#{framework.install_path}/javascripts/fixtures/_boot.html.erb"
|
65
|
+
copy_file "_body.html.erb", "#{framework.install_path}/javascripts/fixtures/_body.html.erb"
|
64
66
|
end
|
65
67
|
|
66
|
-
def
|
68
|
+
def display_post_install
|
67
69
|
readme "POST_INSTALL" if behavior == :invoke
|
68
70
|
end
|
69
71
|
|
70
72
|
private
|
71
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(', ')}]"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
72
81
|
def framework
|
73
|
-
|
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
|
88
|
+
end
|
89
|
+
|
90
|
+
def suite
|
91
|
+
@suite ||= begin
|
92
|
+
config = Teaspoon::Configuration::Suite.new
|
93
|
+
framework.modify_config(config)
|
94
|
+
config
|
95
|
+
end
|
74
96
|
end
|
75
97
|
|
76
|
-
def
|
77
|
-
|
98
|
+
def version
|
99
|
+
@version ||= options[:version] ? determine_requested_version : framework.versions.last
|
78
100
|
end
|
79
101
|
|
80
|
-
def
|
81
|
-
|
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])
|
82
105
|
end
|
83
106
|
|
84
|
-
def
|
85
|
-
|
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)
|
86
116
|
end
|
87
117
|
end
|
88
118
|
end
|