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
@@ -1,23 +0,0 @@
|
|
1
|
-
describe "Mocha Teaspoon.Runner", ->
|
2
|
-
|
3
|
-
beforeEach ->
|
4
|
-
@runSpy = mocha.run = sinon.spy()
|
5
|
-
@runner = new Teaspoon.Runner()
|
6
|
-
|
7
|
-
describe "constructor", ->
|
8
|
-
|
9
|
-
it "calls run on the mocha env", ->
|
10
|
-
@runner.setup = sinon.stub()
|
11
|
-
assert.calledOnce(@runSpy)
|
12
|
-
|
13
|
-
|
14
|
-
describe "#setup", ->
|
15
|
-
|
16
|
-
it "adds the reporter to the env", ->
|
17
|
-
# spy = mocha.setup = sinon.spy()
|
18
|
-
# @runner.params = {grep: "foo"}
|
19
|
-
# @runner.setup()
|
20
|
-
# if window.navigator.userAgent.match(/PhantomJS/)
|
21
|
-
# assert.calledOnce(spy, reporter: Teaspoon.Reporters.Console)
|
22
|
-
# else
|
23
|
-
# assert.calledOnce(spy, reporter: Teaspoon.Reporters.HTML)
|
@@ -1,161 +0,0 @@
|
|
1
|
-
#= require_self
|
2
|
-
#= require drivers/phantomjs/runner
|
3
|
-
|
4
|
-
# stub out phantomjs
|
5
|
-
window.phantom = {exit: ->}
|
6
|
-
window.require = (file) ->
|
7
|
-
switch file
|
8
|
-
when "system" then {args: ["runner.js", "http://host:port/path", "200"]}
|
9
|
-
when "webpage" then create: -> {
|
10
|
-
open: -> {}
|
11
|
-
evaluate: -> {}
|
12
|
-
}
|
13
|
-
|
14
|
-
describe "PhantomJS Runner", ->
|
15
|
-
|
16
|
-
beforeEach ->
|
17
|
-
@logSpy = spyOn(window.console, "log")
|
18
|
-
@runner = new Runner()
|
19
|
-
|
20
|
-
describe "constructor", ->
|
21
|
-
|
22
|
-
it "sets the url from system.args", ->
|
23
|
-
expect(@runner.url).toBe("http://host:port/path")
|
24
|
-
|
25
|
-
it "sets the timeout from system.args", ->
|
26
|
-
expect(@runner.timeout).toBe(200 * 1000)
|
27
|
-
|
28
|
-
|
29
|
-
describe "#run", ->
|
30
|
-
|
31
|
-
beforeEach ->
|
32
|
-
@initSpy = spyOn(@runner, "initPage")
|
33
|
-
@loadSpy = spyOn(@runner, "loadPage")
|
34
|
-
|
35
|
-
it "calls initPage", ->
|
36
|
-
@runner.run()
|
37
|
-
expect(@initSpy).toHaveBeenCalled()
|
38
|
-
|
39
|
-
it "calls loadPage", ->
|
40
|
-
@runner.run()
|
41
|
-
expect(@loadSpy).toHaveBeenCalled()
|
42
|
-
|
43
|
-
|
44
|
-
describe "#initPage", ->
|
45
|
-
|
46
|
-
it "creates a webpage and assigns it to @page", ->
|
47
|
-
@runner.initPage()
|
48
|
-
expect(typeof(@runner.page["open"])).toBe("function")
|
49
|
-
|
50
|
-
|
51
|
-
describe "#loadPage", ->
|
52
|
-
|
53
|
-
beforeEach ->
|
54
|
-
@runner.initPage()
|
55
|
-
|
56
|
-
it "opens the url in the page", ->
|
57
|
-
spy = spyOn(@runner.page, "open")
|
58
|
-
@runner.loadPage()
|
59
|
-
expect(spy).toHaveBeenCalledWith(@runner.url)
|
60
|
-
|
61
|
-
it "attaches all the methods to page", ->
|
62
|
-
spyOn(@runner, "pageCallbacks").andCallFake -> {callback1: "method1", callback2: "method2"}
|
63
|
-
@runner.loadPage()
|
64
|
-
expect(@runner.page.callback1).toBe("method1")
|
65
|
-
expect(@runner.page.callback2).toBe("method2")
|
66
|
-
|
67
|
-
|
68
|
-
describe "#waitForResults", ->
|
69
|
-
|
70
|
-
beforeEach ->
|
71
|
-
@timeoutSpy = spyOn(window, "setTimeout")
|
72
|
-
@runner.initPage()
|
73
|
-
|
74
|
-
it "evaluates in the context of the page", ->
|
75
|
-
spy = spyOn(@runner.page, "evaluate").andReturn(false)
|
76
|
-
@runner.waitForResults()
|
77
|
-
expect(spy).toHaveBeenCalled()
|
78
|
-
|
79
|
-
it "sets a timeout of 100ms if not finished", ->
|
80
|
-
spyOn(@runner.page, "evaluate").andReturn(false)
|
81
|
-
@runner.waitForResults()
|
82
|
-
expect(@timeoutSpy).toHaveBeenCalled()
|
83
|
-
|
84
|
-
it "calls finish if Teaspoon says that it's finished", ->
|
85
|
-
spyOn(@runner.page, "evaluate").andCallFake (f) -> f()
|
86
|
-
spy = spyOn(@runner, "finish")
|
87
|
-
window.Teaspoon.finished = true
|
88
|
-
@runner.waitForResults()
|
89
|
-
expect(spy).toHaveBeenCalled()
|
90
|
-
|
91
|
-
|
92
|
-
describe "#fail", ->
|
93
|
-
|
94
|
-
it "logs the error message", ->
|
95
|
-
@runner.fail("_message_")
|
96
|
-
expect(@logSpy).toHaveBeenCalledWith('{"_teaspoon":true,"type":"exception","message":"_message_"}')
|
97
|
-
|
98
|
-
it "exits with the error code", ->
|
99
|
-
spy = spyOn(phantom, "exit")
|
100
|
-
@runner.fail("_message_", 2)
|
101
|
-
expect(spy).toHaveBeenCalledWith(2)
|
102
|
-
|
103
|
-
|
104
|
-
describe "#finish", ->
|
105
|
-
|
106
|
-
it "calls exit with a success code", ->
|
107
|
-
spy = spyOn(phantom, "exit")
|
108
|
-
@runner.finish()
|
109
|
-
expect(spy).toHaveBeenCalledWith(0)
|
110
|
-
|
111
|
-
|
112
|
-
describe "#pageCallbacks", ->
|
113
|
-
|
114
|
-
it "returns an object with the expected methods", ->
|
115
|
-
return unless Object.keys
|
116
|
-
object = @runner.pageCallbacks()
|
117
|
-
expect(Object.keys(object)).toEqual(["onError", "onConsoleMessage", "onLoadFinished"])
|
118
|
-
|
119
|
-
|
120
|
-
describe "callback method", ->
|
121
|
-
|
122
|
-
beforeEach ->
|
123
|
-
@callbacks = @runner.pageCallbacks()
|
124
|
-
|
125
|
-
describe "#onError", ->
|
126
|
-
|
127
|
-
it "logs the json of a message and trace", ->
|
128
|
-
@callbacks.onError("_message_", ["trace1", "trace2"])
|
129
|
-
expect(@logSpy).toHaveBeenCalledWith('{"_teaspoon":true,"type":"error","message":"_message_","trace":["trace1","trace2"]}')
|
130
|
-
|
131
|
-
it "calls #fail if the error is a TeaspoonError", ->
|
132
|
-
spyOn(@runner, "fail")
|
133
|
-
@callbacks.onError("TeaspoonError: _message_")
|
134
|
-
expect(@runner.fail).toHaveBeenCalledWith("Execution halted.")
|
135
|
-
|
136
|
-
describe "#onConsoleMessage", ->
|
137
|
-
|
138
|
-
it "logs the message", ->
|
139
|
-
@callbacks.onConsoleMessage("_message_")
|
140
|
-
expect(@logSpy).toHaveBeenCalledWith("_message_")
|
141
|
-
|
142
|
-
|
143
|
-
describe "#onLoadFinish", ->
|
144
|
-
|
145
|
-
beforeEach ->
|
146
|
-
@runner.initPage()
|
147
|
-
@waitSpy = spyOn(@runner, "waitForResults")
|
148
|
-
|
149
|
-
it "fails if the status was not success", ->
|
150
|
-
spy = spyOn(@runner, "fail")
|
151
|
-
evalSpy = spyOn(@runner.page, "evaluate").andReturn(true)
|
152
|
-
@callbacks.onLoadFinished("failure")
|
153
|
-
expect(spy).toHaveBeenCalledWith("Failed to load: #{@runner.url}")
|
154
|
-
expect(evalSpy).toHaveBeenCalled()
|
155
|
-
expect(@waitSpy).wasNotCalled()
|
156
|
-
|
157
|
-
|
158
|
-
it "calls waitForResults", ->
|
159
|
-
@callbacks.onLoadFinished("success")
|
160
|
-
expect(@waitSpy).toHaveBeenCalled()
|
161
|
-
|
data/spec/spec_helper.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require "codeclimate-test-reporter"
|
2
|
-
CodeClimate::TestReporter.start
|
3
|
-
|
4
|
-
ENV["RAILS_ENV"] ||= "test"
|
5
|
-
ENV["RAILS_ROOT"] = File.expand_path("../dummy", __FILE__)
|
6
|
-
require File.expand_path("../dummy/config/environment", __FILE__)
|
7
|
-
|
8
|
-
require "rspec/rails"
|
9
|
-
require "capybara/rails"
|
10
|
-
require "aruba/api"
|
11
|
-
|
12
|
-
require "ostruct"
|
13
|
-
|
14
|
-
Dir[File.expand_path("../support/**/*.rb", __FILE__)].each { |f| require f }
|
15
|
-
|
16
|
-
RSpec.configure do |config|
|
17
|
-
config.infer_base_class_for_anonymous_controllers = false
|
18
|
-
config.order = "random"
|
19
|
-
|
20
|
-
config.run_all_when_everything_filtered = true
|
21
|
-
|
22
|
-
config.mock_with :rspec do |c|
|
23
|
-
c.syntax = :expect
|
24
|
-
end
|
25
|
-
end
|
data/spec/support/aruba.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
RSpec.configure do |config|
|
2
|
-
config.include Aruba::Api
|
3
|
-
|
4
|
-
config.before(:each, aruba: true) do
|
5
|
-
@aruba_timeout_seconds = 180
|
6
|
-
FileUtils.rm_rf(current_dir)
|
7
|
-
@__aruba_original_paths = (ENV['PATH'] || '').split(File::PATH_SEPARATOR)
|
8
|
-
ENV['PATH'] = ([File.expand_path('bin')] + @__aruba_original_paths).join(File::PATH_SEPARATOR)
|
9
|
-
end
|
10
|
-
|
11
|
-
config.after(:each, aruba: true) do
|
12
|
-
ENV['PATH'] = @__aruba_original_paths.join(File::PATH_SEPARATOR)
|
13
|
-
restore_env
|
14
|
-
end
|
15
|
-
end
|
@@ -1,157 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "teaspoon/command_line"
|
3
|
-
require "teaspoon/console"
|
4
|
-
|
5
|
-
module Kernel
|
6
|
-
def suppress_warnings
|
7
|
-
original_verbosity = $VERBOSE
|
8
|
-
$VERBOSE = nil
|
9
|
-
result = yield
|
10
|
-
$VERBOSE = original_verbosity
|
11
|
-
return result
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe Teaspoon::CommandLine do
|
16
|
-
|
17
|
-
subject { Teaspoon::CommandLine }
|
18
|
-
|
19
|
-
let(:console) { double(failures?: false) }
|
20
|
-
let(:parser) { double(parse!: ["file1", "file2"]) }
|
21
|
-
|
22
|
-
describe "#initialize" do
|
23
|
-
|
24
|
-
before do
|
25
|
-
allow(Teaspoon::Console).to receive(:new).and_return(console)
|
26
|
-
allow_any_instance_of(subject).to receive(:abort)
|
27
|
-
allow_any_instance_of(subject).to receive(:opt_parser).and_return(parser)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "assigns @options and adds the files that were parsed out" do
|
31
|
-
expect(subject.new.instance_variable_get(:@options)).to eq(files: ["file1", "file2"])
|
32
|
-
end
|
33
|
-
|
34
|
-
it "aborts with a message on Teaspoon::EnvironmentNotFound" do
|
35
|
-
expect(Teaspoon::Console).to receive(:new).and_raise(Teaspoon::EnvironmentNotFound)
|
36
|
-
expect_any_instance_of(subject).to receive(:abort).with("Teaspoon::EnvironmentNotFound\nConsider using -r path/to/teaspoon_env\n")
|
37
|
-
subject.new
|
38
|
-
end
|
39
|
-
|
40
|
-
it "executes using Teaspoon::Console" do
|
41
|
-
expect(Teaspoon::Console).to receive(:new).with(files: ["file1", "file2"])
|
42
|
-
expect(console).to receive(:failures?)
|
43
|
-
subject.new
|
44
|
-
end
|
45
|
-
|
46
|
-
it "aborts if Teaspoon::Console fails" do
|
47
|
-
expect_any_instance_of(subject).to receive(:abort)
|
48
|
-
expect(console).to receive(:failures?).and_return(true)
|
49
|
-
subject.new
|
50
|
-
end
|
51
|
-
|
52
|
-
it "logs a message and exits on abort" do
|
53
|
-
expect(STDOUT).to receive(:print).with("Teaspoon::EnvironmentNotFound\nConsider using -r path/to/teaspoon_env\n")
|
54
|
-
expect(Teaspoon::Console).to receive(:new).and_raise(Teaspoon::EnvironmentNotFound)
|
55
|
-
expect_any_instance_of(subject).to receive(:abort).and_call_original
|
56
|
-
expect { subject.new }.to raise_error(SystemExit)
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
describe "opt_parser" do
|
62
|
-
|
63
|
-
before do
|
64
|
-
@log = ""
|
65
|
-
allow(STDOUT).to receive(:print) { |s| @log << s }
|
66
|
-
allow(Teaspoon::Console).to receive(:new).and_return(console)
|
67
|
-
end
|
68
|
-
|
69
|
-
it "has --help" do
|
70
|
-
suppress_warnings { ARGV = ["--help"] }
|
71
|
-
expect { subject.new.opt_parser }.to raise_error(SystemExit)
|
72
|
-
expect(@log).to include <<-OUTPUT.strip_heredoc
|
73
|
-
Usage: teaspoon [options] [files]
|
74
|
-
|
75
|
-
-r, --require FILE Require Teaspoon environment file.
|
76
|
-
-d, --driver DRIVER Specify driver:
|
77
|
-
phantomjs (default)
|
78
|
-
selenium
|
79
|
-
capybara_webkit
|
80
|
-
--driver-options OPTIONS Specify driver-specific options to pass into the driver.
|
81
|
-
e.g. "--ssl-protocol=any --ssl-certificates-path=/path/to/certs".
|
82
|
-
Driver options are only supported with phantomjs.
|
83
|
-
--driver-timeout SECONDS Sets the timeout for the driver to wait before exiting.
|
84
|
-
--server SERVER Sets server to use with Rack.
|
85
|
-
e.g. webrick, thin
|
86
|
-
--server-port PORT Sets the server to use a specific port.
|
87
|
-
--server-timeout SECONDS Sets the timeout that the server must start within.
|
88
|
-
-F, --[no-]fail-fast Abort after the first failing suite.
|
89
|
-
|
90
|
-
**** Filtering ****
|
91
|
-
|
92
|
-
-s, --suite SUITE Focus to a specific suite.
|
93
|
-
-g, --filter FILTER Filter tests matching a specific filter.
|
94
|
-
|
95
|
-
**** Output ****
|
96
|
-
|
97
|
-
-q, --[no-]suppress-log Suppress logs coming from console[log/debug/error].
|
98
|
-
-c, --[no-]color Enable/Disable color output.
|
99
|
-
-e, --export [OUTPUT_PATH] Exports the test suite as the full HTML (requires wget).
|
100
|
-
-f, --format FORMATTERS Specify formatters (comma separated)
|
101
|
-
#{Teaspoon::Formatters.known_formatters.map(&:cli_help).join("\n" + (" " * 43))}
|
102
|
-
|
103
|
-
**** Coverage ****
|
104
|
-
|
105
|
-
-C, --coverage CONFIG_NAME Generate coverage reports using a pre-defined coverage configuration.
|
106
|
-
|
107
|
-
**** Utility ****
|
108
|
-
|
109
|
-
-v, --version Display the version.
|
110
|
-
-h, --help You're looking at it.
|
111
|
-
OUTPUT
|
112
|
-
end
|
113
|
-
|
114
|
-
it "has --version" do
|
115
|
-
suppress_warnings { ARGV = ["--version"] }
|
116
|
-
expect { subject.new.opt_parser }.to raise_error(SystemExit)
|
117
|
-
expect(@log).to match(/\d+\.\d+\.\d+\n/)
|
118
|
-
end
|
119
|
-
|
120
|
-
it "has various other arguments" do
|
121
|
-
value_flags = {
|
122
|
-
environment: ["require", "_environment_"],
|
123
|
-
driver: ["driver", "_driver_"],
|
124
|
-
driver_options: ["driver-options", "_driver_options_"],
|
125
|
-
driver_timeout: ["driver-timeout", "_driver_timeout_"],
|
126
|
-
server: ["server", "_server_"],
|
127
|
-
server_port: ["server-port", "_server_port_"],
|
128
|
-
server_timeout: ["server-timeout", "_server_timeout_"],
|
129
|
-
suite: ["suite", "_suite_"],
|
130
|
-
filter: ["filter", "_filter_"],
|
131
|
-
export: ["export", "_export_"],
|
132
|
-
formatters: ["format", "_foo,bar_"],
|
133
|
-
use_coverage: ["coverage", "_coverage_"],
|
134
|
-
}
|
135
|
-
|
136
|
-
bool_flags = {
|
137
|
-
fail_fast: "fail-fast",
|
138
|
-
suppress_log: "suppress-log",
|
139
|
-
color: "color",
|
140
|
-
}
|
141
|
-
|
142
|
-
value_flags.each do |k, v|
|
143
|
-
suppress_warnings { ARGV = ["--#{v[0]}=#{v[1]}"] }
|
144
|
-
expect(subject.new.instance_variable_get(:@options)[k]).to eq(v[1])
|
145
|
-
end
|
146
|
-
|
147
|
-
bool_flags.each do |k, v|
|
148
|
-
suppress_warnings { ARGV = ["--#{v}"] }
|
149
|
-
expect(subject.new.instance_variable_get(:@options)[k]).to eq(true)
|
150
|
-
suppress_warnings { ARGV = ["--no-#{v}"] }
|
151
|
-
expect(subject.new.instance_variable_get(:@options)[k]).to eq(false)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
end
|
156
|
-
|
157
|
-
end
|
@@ -1,236 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Teaspoon do
|
4
|
-
|
5
|
-
subject { Teaspoon }
|
6
|
-
|
7
|
-
it "has a configuration property" do
|
8
|
-
expect(subject.configuration).to be(Teaspoon::Configuration)
|
9
|
-
end
|
10
|
-
|
11
|
-
describe ".configure" do
|
12
|
-
|
13
|
-
it "yields configuration" do
|
14
|
-
config = nil
|
15
|
-
subject.configure { |c| config = c }
|
16
|
-
expect(config).to be(Teaspoon::Configuration)
|
17
|
-
end
|
18
|
-
|
19
|
-
it "sets configured to true" do
|
20
|
-
subject.configured = false
|
21
|
-
subject.configure { }
|
22
|
-
expect(subject.configured).to be_truthy
|
23
|
-
end
|
24
|
-
|
25
|
-
it "overrides configuration from ENV" do
|
26
|
-
expect(subject.configuration).to receive(:override_from_env).with(ENV)
|
27
|
-
subject.configure { }
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
describe ".setup" do
|
33
|
-
|
34
|
-
it "calls configure" do
|
35
|
-
block = proc{}
|
36
|
-
expect(subject).to receive(:configure).with(no_args) { |&arg| expect(arg).to eq(block) }
|
37
|
-
subject.setup(&block)
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
describe Teaspoon::Configuration do
|
46
|
-
|
47
|
-
subject { Teaspoon::Configuration }
|
48
|
-
|
49
|
-
before do
|
50
|
-
@orig_root = subject.root
|
51
|
-
@orig_asset_paths = subject.asset_paths
|
52
|
-
@orig_formatters = subject.formatters
|
53
|
-
end
|
54
|
-
|
55
|
-
after do
|
56
|
-
subject.mount_at = "/teaspoon"
|
57
|
-
subject.suite_configs.delete("test_suite")
|
58
|
-
subject.server = nil
|
59
|
-
subject.root = @orig_root
|
60
|
-
subject.asset_paths = @orig_asset_paths
|
61
|
-
subject.formatters = @orig_formatters
|
62
|
-
end
|
63
|
-
|
64
|
-
it "has the default configuration" do
|
65
|
-
expect(subject.mount_at).to eq("/teaspoon")
|
66
|
-
expect(subject.root).to eq(Rails.root.join('..', '..'))
|
67
|
-
expect(subject.asset_paths).to include("spec/javascripts")
|
68
|
-
expect(subject.asset_paths).to include("spec/javascripts/stylesheets")
|
69
|
-
expect(subject.fixture_paths).to eq(["spec/javascripts/fixtures", "test/javascripts/fixtures"])
|
70
|
-
|
71
|
-
expect(subject.driver).to eq("phantomjs")
|
72
|
-
expect(subject.driver_options).to be_nil
|
73
|
-
expect(subject.driver_timeout).to eq(180)
|
74
|
-
expect(subject.server).to be_nil
|
75
|
-
expect(subject.server_port).to be_nil
|
76
|
-
expect(subject.server_timeout).to eq(20)
|
77
|
-
expect(subject.formatters).to eq(['dot'])
|
78
|
-
expect(subject.use_coverage).to be_nil
|
79
|
-
expect(subject.fail_fast).to be_truthy
|
80
|
-
expect(subject.suppress_log).to be_falsey
|
81
|
-
expect(subject.color).to be_truthy
|
82
|
-
|
83
|
-
expect(subject.suite_configs).to be_a(Hash)
|
84
|
-
expect(subject.coverage_configs).to be_a(Hash)
|
85
|
-
end
|
86
|
-
|
87
|
-
it "allows setting various configuration options" do
|
88
|
-
subject.mount_at = "/teaspoons_are_awesome"
|
89
|
-
expect(subject.mount_at).to eq("/teaspoons_are_awesome")
|
90
|
-
subject.server = :webrick
|
91
|
-
expect(subject.server).to eq(:webrick)
|
92
|
-
end
|
93
|
-
|
94
|
-
it "allows defining suite configurations" do
|
95
|
-
subject.suite(:test_suite) { }
|
96
|
-
expect(subject.suite_configs["test_suite"][:block]).to be_a(Proc)
|
97
|
-
expect(subject.suite_configs["test_suite"][:instance]).to be_a(Teaspoon::Configuration::Suite)
|
98
|
-
end
|
99
|
-
|
100
|
-
it "allows defining coverage configurations" do
|
101
|
-
subject.coverage(:test_coverage) { }
|
102
|
-
expect(subject.coverage_configs["test_coverage"][:block]).to be_a(Proc)
|
103
|
-
expect(subject.coverage_configs["test_coverage"][:instance]).to be_a(Teaspoon::Configuration::Coverage)
|
104
|
-
end
|
105
|
-
|
106
|
-
describe ".root=" do
|
107
|
-
|
108
|
-
it "forces the path provided into a Pathname" do
|
109
|
-
subject.root = "/path"
|
110
|
-
expect(subject.root).to be_a(Pathname)
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|
114
|
-
|
115
|
-
describe ".formatters" do
|
116
|
-
|
117
|
-
it "returns the default dot formatter if nothing was set" do
|
118
|
-
expect(subject.formatters).to eq(["dot"])
|
119
|
-
end
|
120
|
-
|
121
|
-
it "returns an array of formatters if they were comma separated" do
|
122
|
-
subject.formatters = "dot,swayze_or_oprah"
|
123
|
-
expect(subject.formatters).to eq(["dot", "swayze_or_oprah"])
|
124
|
-
end
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
describe ".override_from_options" do
|
129
|
-
|
130
|
-
it "allows overriding from options" do
|
131
|
-
expect(subject).to receive(:fail_fast=).with(true)
|
132
|
-
expect(subject).to receive(:driver_timeout=).with(123)
|
133
|
-
expect(subject).to receive(:driver=).with("driver")
|
134
|
-
|
135
|
-
subject.send(:override_from_options, fail_fast: true, driver_timeout: 123, driver: "driver")
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
|
140
|
-
describe ".override_from_env" do
|
141
|
-
|
142
|
-
it "allows overriding from the env" do
|
143
|
-
expect(subject).to receive(:fail_fast=).with(true)
|
144
|
-
expect(subject).to receive(:driver_timeout=).with(123)
|
145
|
-
expect(subject).to receive(:driver=).with("driver")
|
146
|
-
|
147
|
-
subject.send(:override_from_env, "FAIL_FAST" => "true", "DRIVER_TIMEOUT" => "123", "DRIVER" => "driver")
|
148
|
-
end
|
149
|
-
|
150
|
-
end
|
151
|
-
|
152
|
-
end
|
153
|
-
|
154
|
-
|
155
|
-
describe Teaspoon::Configuration::Suite do
|
156
|
-
|
157
|
-
subject { Teaspoon::Configuration::Suite.new &(@suite || proc{}) }
|
158
|
-
|
159
|
-
it "has the default configuration" do
|
160
|
-
expect(subject.matcher).to eq("{spec/javascripts,spec/dummy/app/assets/javascripts/specs}/**/*_spec.{js,js.coffee,coffee,js.coffee.erb}")
|
161
|
-
expect(subject.helper).to eq("spec_helper")
|
162
|
-
expect(subject.javascripts).to eq(["jasmine/1.3.1", "teaspoon/jasmine"])
|
163
|
-
expect(subject.stylesheets).to eq(["teaspoon"])
|
164
|
-
expect(subject.no_coverage).to eq([%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}])
|
165
|
-
expect(subject.expand_assets).to eq(true)
|
166
|
-
end
|
167
|
-
|
168
|
-
it "accepts a block that can override defaults" do
|
169
|
-
@suite = proc{ |s| s.helper = "helper_file" }
|
170
|
-
expect(subject.helper).to eq("helper_file")
|
171
|
-
end
|
172
|
-
|
173
|
-
it "allows registering hooks" do
|
174
|
-
expect(subject.hooks).to eq({})
|
175
|
-
subject.hook {}
|
176
|
-
expect(subject.hooks['default'].length).to eq(1)
|
177
|
-
end
|
178
|
-
|
179
|
-
describe "specifying a framework" do
|
180
|
-
|
181
|
-
it "allows specifying mocha with a version" do
|
182
|
-
@suite = proc{ |s| s.use_framework :mocha, "1.10.0" }
|
183
|
-
expect(subject.javascripts).to eq(["mocha/1.10.0", "teaspoon-mocha"])
|
184
|
-
end
|
185
|
-
|
186
|
-
it "handles qunit specifically to set matcher and helper" do
|
187
|
-
@suite = proc{ |s| s.use_framework :qunit }
|
188
|
-
expect(subject.javascripts).to eq(["qunit/1.14.0", "teaspoon-qunit"])
|
189
|
-
expect(subject.matcher).to eq("{test/javascripts,app/assets}/**/*_test.{js,js.coffee,coffee}")
|
190
|
-
expect(subject.helper).to eq("test_helper")
|
191
|
-
end
|
192
|
-
|
193
|
-
describe "exceptions" do
|
194
|
-
|
195
|
-
it "shows an error for unknown frameworks" do
|
196
|
-
@suite = proc{ |s| s.use_framework :foo }
|
197
|
-
expect{ subject }.to raise_error(
|
198
|
-
Teaspoon::UnknownFramework,
|
199
|
-
"Unknown framework \"foo\""
|
200
|
-
)
|
201
|
-
end
|
202
|
-
|
203
|
-
it "shows an error for unknown versions" do
|
204
|
-
@suite = proc{ |s| s.use_framework :qunit, "666" }
|
205
|
-
expect{ subject }.to raise_error(
|
206
|
-
Teaspoon::UnknownFramework,
|
207
|
-
"Unknown framework \"qunit\" with version 666 -- available versions 1.12.0, 1.14.0"
|
208
|
-
)
|
209
|
-
end
|
210
|
-
|
211
|
-
end
|
212
|
-
|
213
|
-
end
|
214
|
-
|
215
|
-
end
|
216
|
-
|
217
|
-
|
218
|
-
describe Teaspoon::Configuration::Coverage do
|
219
|
-
|
220
|
-
subject { Teaspoon::Configuration::Coverage.new &(@coverage || proc{}) }
|
221
|
-
|
222
|
-
it "has the default configuration" do
|
223
|
-
expect(subject.reports).to eq(["text-summary"])
|
224
|
-
expect(subject.output_path).to eq("coverage")
|
225
|
-
expect(subject.statements).to be_nil
|
226
|
-
expect(subject.functions).to be_nil
|
227
|
-
expect(subject.branches).to be_nil
|
228
|
-
expect(subject.lines).to be_nil
|
229
|
-
end
|
230
|
-
|
231
|
-
it "accepts a block that can override defaults" do
|
232
|
-
@coverage = proc{ |s| s.reports = "report_format" }
|
233
|
-
expect(subject.reports).to eq("report_format")
|
234
|
-
end
|
235
|
-
|
236
|
-
end
|