teaspoon 0.7.9 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +382 -260
- data/app/assets/javascripts/teaspoon-angular.js +108 -26241
- data/app/assets/javascripts/teaspoon-jasmine.js +103 -2642
- data/app/assets/javascripts/teaspoon-mocha.js +109 -5416
- data/app/assets/javascripts/teaspoon-qunit.js +107 -2255
- data/app/assets/javascripts/teaspoon-teaspoon.js +0 -1
- data/app/assets/javascripts/teaspoon/angular.coffee +3 -1
- data/app/assets/javascripts/teaspoon/base/hook.coffee +21 -0
- data/app/assets/javascripts/teaspoon/base/reporters/html.coffee +26 -14
- data/app/assets/javascripts/teaspoon/base/reporters/html/progress_view.coffee +1 -1
- data/app/assets/javascripts/teaspoon/base/reporters/html/template.coffee +3 -3
- data/app/assets/javascripts/teaspoon/base/teaspoon.coffee +10 -1
- data/app/assets/javascripts/teaspoon/jasmine.coffee +3 -1
- data/app/assets/javascripts/teaspoon/mocha.coffee +3 -1
- data/app/assets/javascripts/teaspoon/mocha/reporters/html.coffee +1 -1
- data/app/assets/javascripts/teaspoon/qunit.coffee +3 -1
- data/app/assets/javascripts/teaspoon/qunit/reporters/html.coffee +1 -1
- data/app/assets/javascripts/teaspoon/teaspoon.coffee +0 -1
- data/app/assets/stylesheets/teaspoon.css +12 -8
- data/app/controllers/teaspoon/suite_controller.rb +32 -0
- data/app/views/teaspoon/suite/_body.html.erb +0 -0
- data/app/views/teaspoon/suite/_boot.html.erb +4 -0
- data/app/views/teaspoon/suite/_boot_require_js.html.erb +19 -0
- data/app/views/teaspoon/{spec/suites.html.erb → suite/index.html.erb} +6 -7
- data/app/views/teaspoon/suite/show.html.erb +19 -0
- data/bin/teaspoon +1 -1
- data/config/routes.rb +14 -4
- data/lib/generators/teaspoon/install/POST_INSTALL +2 -2
- data/lib/generators/teaspoon/install/install_generator.rb +22 -11
- data/lib/generators/teaspoon/install/templates/_body.html.erb +0 -0
- data/lib/generators/teaspoon/install/templates/_boot.html.erb +4 -0
- data/lib/generators/teaspoon/install/templates/jasmine/env.rb +11 -0
- data/lib/generators/teaspoon/install/templates/jasmine/env_comments.rb +182 -0
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +8 -6
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +8 -7
- data/lib/generators/teaspoon/install/templates/mocha/env.rb +11 -0
- data/lib/generators/teaspoon/install/templates/mocha/env_comments.rb +182 -0
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +13 -13
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +13 -13
- data/lib/generators/teaspoon/install/templates/qunit/env.rb +11 -0
- data/lib/generators/teaspoon/install/templates/qunit/env_comments.rb +182 -0
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +6 -5
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +6 -5
- data/lib/tasks/teaspoon.rake +9 -2
- data/lib/teaspoon.rb +4 -6
- data/lib/teaspoon/command_line.rb +116 -134
- data/lib/teaspoon/configuration.rb +144 -66
- data/lib/teaspoon/console.rb +70 -37
- data/lib/teaspoon/coverage.rb +42 -15
- data/lib/teaspoon/deprecated.rb +65 -0
- data/lib/teaspoon/drivers/base.rb +10 -0
- data/lib/teaspoon/drivers/phantomjs/runner.js +9 -11
- data/lib/teaspoon/drivers/phantomjs_driver.rb +21 -21
- data/lib/teaspoon/drivers/selenium_driver.rb +32 -13
- data/lib/teaspoon/engine.rb +32 -12
- data/lib/teaspoon/environment.rb +16 -12
- data/lib/teaspoon/exceptions.rb +41 -5
- data/lib/teaspoon/exporter.rb +52 -0
- data/lib/teaspoon/formatters/base.rb +171 -0
- data/lib/teaspoon/formatters/clean_formatter.rb +2 -4
- data/lib/teaspoon/formatters/documentation_formatter.rb +60 -0
- data/lib/teaspoon/formatters/dot_formatter.rb +12 -90
- data/lib/teaspoon/formatters/json_formatter.rb +36 -0
- data/lib/teaspoon/formatters/junit_formatter.rb +51 -32
- data/lib/teaspoon/formatters/modules/report_module.rb +76 -0
- data/lib/teaspoon/formatters/pride_formatter.rb +23 -27
- data/lib/teaspoon/formatters/snowday_formatter.rb +7 -11
- data/lib/teaspoon/formatters/swayze_or_oprah_formatter.rb +88 -64
- data/lib/teaspoon/formatters/tap_formatter.rb +18 -27
- data/lib/teaspoon/formatters/tap_y_formatter.rb +35 -45
- data/lib/teaspoon/formatters/teamcity_formatter.rb +69 -31
- data/lib/teaspoon/instrumentation.rb +33 -33
- data/lib/teaspoon/result.rb +2 -1
- data/lib/teaspoon/runner.rb +40 -28
- data/lib/teaspoon/server.rb +23 -25
- data/lib/teaspoon/suite.rb +52 -72
- data/lib/teaspoon/utility.rb +3 -14
- data/lib/teaspoon/version.rb +1 -1
- data/spec/dummy/app/assets/javascripts/integration/integration_spec.coffee +3 -0
- data/spec/dummy/app/assets/javascripts/integration/spec_helper.coffee +2 -0
- data/spec/dummy/config/application.rb +3 -0
- data/spec/features/console_reporter_spec.rb +48 -18
- data/spec/features/hooks_spec.rb +23 -41
- data/spec/features/html_reporter_spec.rb +38 -21
- data/spec/features/install_generator_spec.rb +34 -20
- data/spec/features/instrumentation_spec.rb +3 -2
- data/spec/fixtures/coverage.json +243 -0
- data/spec/javascripts/fixtures/_body.html.erb +1 -0
- data/spec/javascripts/jasmine_helper.coffee +1 -1
- data/spec/javascripts/teaspoon/base/fixture_spec.coffee +4 -4
- data/spec/javascripts/teaspoon/base/reporters/html_spec.coffee +9 -10
- data/spec/javascripts/teaspoon/mocha/reporters/html_mspec.coffee +0 -6
- data/spec/javascripts/teaspoon/phantomjs/runner_spec.coffee +5 -6
- data/spec/javascripts/turbolinks_helper.coffee +1 -1
- data/spec/spec_helper.rb +3 -4
- data/spec/teaspoon/command_line_spec.rb +139 -23
- data/spec/teaspoon/configuration_spec.rb +164 -46
- data/spec/teaspoon/console_spec.rb +142 -47
- data/spec/teaspoon/coverage_spec.rb +98 -28
- data/spec/teaspoon/drivers/base_spec.rb +5 -0
- data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +32 -14
- data/spec/teaspoon/drivers/selenium_driver_spec.rb +32 -24
- data/spec/teaspoon/engine_spec.rb +8 -5
- data/spec/teaspoon/environment_spec.rb +56 -33
- data/spec/teaspoon/exceptions_spec.rb +57 -0
- data/spec/teaspoon/exporter_spec.rb +96 -0
- data/spec/teaspoon/formatters/base_spec.rb +259 -0
- data/spec/teaspoon/formatters/clean_formatter_spec.rb +37 -0
- data/spec/teaspoon/formatters/documentation_formatter_spec.rb +127 -0
- data/spec/teaspoon/formatters/dot_formatter_spec.rb +52 -56
- data/spec/teaspoon/formatters/json_formatter_spec.rb +77 -0
- data/spec/teaspoon/formatters/junit_formatter_spec.rb +72 -35
- data/spec/teaspoon/formatters/pride_formatter_spec.rb +37 -0
- data/spec/teaspoon/formatters/snowday_formatter_spec.rb +35 -0
- data/spec/teaspoon/formatters/tap_formatter_spec.rb +29 -81
- data/spec/teaspoon/formatters/tap_y_formatter_spec.rb +31 -141
- data/spec/teaspoon/formatters/teamcity_formatter_spec.rb +99 -42
- data/spec/teaspoon/instrumentation_spec.rb +44 -44
- data/spec/teaspoon/result_spec.rb +37 -0
- data/spec/teaspoon/runner_spec.rb +70 -59
- data/spec/teaspoon/server_spec.rb +34 -52
- data/spec/teaspoon/suite_spec.rb +42 -188
- data/spec/teaspoon_env.rb +39 -28
- data/vendor/assets/javascripts/{angular-scenario-1.0.5.js → angular/1.0.5.js} +0 -0
- data/vendor/assets/javascripts/{angular-scenario-1.0.5.MIT-LICENSE → angular/MIT-LICENSE} +0 -0
- data/vendor/assets/javascripts/{jasmine-1.3.1.js → jasmine/1.3.1.js} +0 -0
- data/vendor/assets/javascripts/jasmine/2.0.0.js +2412 -0
- data/vendor/assets/javascripts/{jasmine-1.3.1.MIT.LICENSE → jasmine/MIT.LICENSE} +0 -0
- data/vendor/assets/javascripts/{mocha-1.10.0.js → mocha/1.10.0.js} +1 -0
- data/vendor/assets/javascripts/mocha/1.17.1.js +5813 -0
- data/vendor/assets/javascripts/{mocha-1.10.1.MIT.LICENSE → mocha/MIT.LICENSE} +0 -0
- data/vendor/assets/javascripts/{qunit-1.12.0.js → qunit/1.12.0.js} +1 -1
- data/vendor/assets/javascripts/qunit/1.14.0.js +2288 -0
- data/vendor/assets/javascripts/{qunit-1.12.0.MIT.LICENSE → qunit/MIT.LICENSE} +0 -0
- data/vendor/assets/javascripts/support/chai.js +827 -385
- data/vendor/assets/javascripts/support/jasmine-jquery-1.7.0.js +720 -0
- data/vendor/assets/javascripts/support/jasmine-jquery-2.0.0.js +812 -0
- data/vendor/assets/javascripts/support/sinon-chai.js +17 -0
- data/vendor/assets/javascripts/support/sinon.js +1138 -643
- metadata +57 -36
- data/app/controllers/teaspoon/spec_controller.rb +0 -38
- data/app/helpers/teaspoon/spec_helper.rb +0 -36
- data/app/views/teaspoon/spec/_require_js.html.erb +0 -21
- data/app/views/teaspoon/spec/_standard.html.erb +0 -4
- data/app/views/teaspoon/spec/runner.html.erb +0 -19
- data/lib/generators/teaspoon/install/templates/env.rb +0 -38
- data/lib/generators/teaspoon/install/templates/jasmine/initializer.rb +0 -64
- data/lib/generators/teaspoon/install/templates/mocha/initializer.rb +0 -64
- data/lib/generators/teaspoon/install/templates/qunit/initializer.rb +0 -64
- data/lib/teaspoon/check_coverage.rb +0 -33
- data/lib/teaspoon/drivers/base_driver.rb +0 -10
- data/lib/teaspoon/exception_handling.rb +0 -18
- data/lib/teaspoon/formatters/base_formatter.rb +0 -63
- data/spec/dummy/config/initializers/teaspoon.rb +0 -41
- data/spec/teaspoon/check_coverage_spec.rb +0 -50
- data/spec/teaspoon/formatters/base_formatter_spec.rb +0 -45
- data/vendor/assets/javascripts/support/chai.MIT.LICENSE +0 -22
- data/vendor/assets/javascripts/support/expect.MIT.LICENSE +0 -22
- data/vendor/assets/javascripts/support/jasmine-jquery.MIT.LICENSE +0 -20
- data/vendor/assets/javascripts/support/jasmine-jquery.js +0 -659
- data/vendor/assets/javascripts/support/sinon-chai.MIT-ISH.LICENSE +0 -13
- data/vendor/assets/javascripts/support/sinon.BSD.LICENSE +0 -27
@@ -0,0 +1,37 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Teaspoon::Formatters::CleanFormatter do
|
4
|
+
|
5
|
+
let(:passing_spec) { double(passing?: true) }
|
6
|
+
let(:pending_spec) { double(passing?: false, pending?: true, description: "_description_") }
|
7
|
+
let(:failing_spec) { double(passing?: false, pending?: false, description: "_description_", message: "_message_", link: "_link_") }
|
8
|
+
|
9
|
+
before do
|
10
|
+
@log = ""
|
11
|
+
STDOUT.stub(:print) { |s| @log << s }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#result" do
|
15
|
+
|
16
|
+
let(:result) { double(elapsed: 3.1337, coverage: nil) }
|
17
|
+
|
18
|
+
before do
|
19
|
+
subject.run_count = 666
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "with failures" do
|
23
|
+
|
24
|
+
before do
|
25
|
+
subject.failures << failing_spec
|
26
|
+
end
|
27
|
+
|
28
|
+
it "logs the failures but not the failure commands" do
|
29
|
+
subject.result(result)
|
30
|
+
expect(@log).to eq("\n\nFailures:\n\n 1) _description_\n\e[31m Failure/Error: _message_\n\e[0m\nFinished in 3.1337 seconds\n\e[31m666 examples, 1 failure\e[0m\n")
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Teaspoon::Formatters::DocumentationFormatter do
|
4
|
+
|
5
|
+
let(:suite) { double(label: "_suite_", level: @level || 0)}
|
6
|
+
let(:passing_spec) { double(passing?: true, label: "_passing_") }
|
7
|
+
let(:pending_spec) { double(passing?: false, pending?: true, label: "_pending_", description: "_description_") }
|
8
|
+
let(:failing_spec) { double(passing?: false, pending?: false, label: "_failing_", description: "_description_", message: "_message_", link: "_link_") }
|
9
|
+
|
10
|
+
before do
|
11
|
+
@log = ""
|
12
|
+
STDOUT.stub(:print) { |s| @log << s }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "#suite" do
|
16
|
+
|
17
|
+
it "logs a properly indented suite message" do
|
18
|
+
@level = 2
|
19
|
+
subject.suite(suite)
|
20
|
+
expect(@log).to eq(" _suite_\n")
|
21
|
+
expect(subject.instance_variable_get(:@level)).to eq(2)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#spec" do
|
27
|
+
|
28
|
+
before do
|
29
|
+
subject.instance_variable_set(:@level, 1)
|
30
|
+
subject.instance_variable_set(:@last_suite, {})
|
31
|
+
subject.instance_variable_set(:@stdout, "line1\nline2\n")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "logs an indented green label on passing results" do
|
35
|
+
subject.spec(passing_spec)
|
36
|
+
expect(@log).to eq("\e[32m _passing_\e[0m\n\e[36m # line1\n # line2\e[0m\n")
|
37
|
+
end
|
38
|
+
|
39
|
+
it "logs an indented yellow label on pending results" do
|
40
|
+
subject.instance_variable_set(:@level, 1)
|
41
|
+
subject.instance_variable_set(:@last_suite, {})
|
42
|
+
subject.spec(pending_spec)
|
43
|
+
expect(@log).to eq("\e[33m _pending_ (PENDING)\e[0m\n\e[36m # line1\n # line2\e[0m\n")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "logs an indented red label (with stdout) on failing results" do
|
47
|
+
subject.spec(failing_spec)
|
48
|
+
expect(@log).to eq("\e[31m _failing_ (FAILED - 1)\e[0m\n\e[36m # line1\n # line2\e[0m\n")
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "#error" do
|
54
|
+
|
55
|
+
let(:result) { double(message: "_message_", trace: [{"file" => "http://127.0.0.1:31337/assets/path/file.js?foo=true&body=1", "line" => 42, "function" => "notAnAnonFunc"}]) }
|
56
|
+
|
57
|
+
it "logs the error" do
|
58
|
+
subject.error(result)
|
59
|
+
expect(@log).to eq("\e[31m_message_\e[0m\n\e[36m # path/file.js?foo=true:42 -- notAnAnonFunc\e[0m\n\n")
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "#result" do
|
65
|
+
|
66
|
+
let(:result) { double(elapsed: 3.1337, coverage: nil) }
|
67
|
+
|
68
|
+
before do
|
69
|
+
subject.run_count = 666
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "with no failures" do
|
73
|
+
|
74
|
+
it "logs the stats" do
|
75
|
+
subject.result(result)
|
76
|
+
expect(@log).to eq("\nFinished in 3.1337 seconds\n\e[32m666 examples, 0 failures\e[0m\n")
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "with failures" do
|
82
|
+
|
83
|
+
before do
|
84
|
+
subject.failures << failing_spec
|
85
|
+
end
|
86
|
+
|
87
|
+
it "logs the failures" do
|
88
|
+
subject.result(result)
|
89
|
+
expect(@log).to eq("\nFailures:\n\n 1) _description_\n\e[31m Failure/Error: _message_\n\e[0m\nFinished in 3.1337 seconds\n\e[31m666 examples, 1 failure\e[0m\n\nFailed examples:\n\n\e[31mteaspoon -s default --filter=\"_link_\"\e[0m\n")
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
describe "with pending" do
|
95
|
+
|
96
|
+
before do
|
97
|
+
subject.pendings << pending_spec
|
98
|
+
end
|
99
|
+
|
100
|
+
it "logs the pending specs" do
|
101
|
+
subject.result(result)
|
102
|
+
expect(@log).to eq("\nPending:\n\e[33m _description_\e[0m\n\e[36m # Not yet implemented\n\e[0m\nFinished in 3.1337 seconds\n\e[33m666 examples, 0 failures, 1 pending\e[0m\n")
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
describe "#coverage" do
|
110
|
+
|
111
|
+
it "logs the coverage" do
|
112
|
+
subject.coverage("_text_\n\n_text_summary_")
|
113
|
+
expect(@log).to eq("\n_text_\n\n_text_summary_\n")
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
describe "#threshold_failure" do
|
119
|
+
|
120
|
+
it "logs the threshold failures" do
|
121
|
+
subject.threshold_failure("_was_not_met_\n_was_not_met_")
|
122
|
+
expect(@log).to eq("\e[31m\n_was_not_met_\n_was_not_met_\n\e[0m\n")
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
require "teaspoon/formatters/dot_formatter"
|
3
|
-
require "teaspoon/result"
|
4
2
|
|
5
3
|
describe Teaspoon::Formatters::DotFormatter do
|
6
4
|
|
5
|
+
let(:passing_spec) { double(passing?: true) }
|
6
|
+
let(:pending_spec) { double(passing?: false, pending?: true, description: "_description_") }
|
7
|
+
let(:failing_spec) { double(passing?: false, pending?: false, description: "_description_", message: "_message_", link: "_link_") }
|
8
|
+
|
7
9
|
before do
|
8
10
|
@log = ""
|
9
11
|
STDOUT.stub(:print) { |s| @log << s }
|
@@ -11,110 +13,104 @@ describe Teaspoon::Formatters::DotFormatter do
|
|
11
13
|
|
12
14
|
describe "#spec" do
|
13
15
|
|
14
|
-
it "
|
15
|
-
subject.
|
16
|
-
|
17
|
-
subject.spec(Teaspoon::Result.build_from_json("status" => "passed"))
|
18
|
-
expect(subject.total).to be(42)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "logs a green . on pass" do
|
22
|
-
subject.should_receive(:log).with(".", 32)
|
23
|
-
subject.spec(Teaspoon::Result.build_from_json("status" => "passed"))
|
16
|
+
it "logs a green . on passing results" do
|
17
|
+
subject.spec(passing_spec)
|
18
|
+
expect(@log).to eq("\e[32m.\e[0m")
|
24
19
|
end
|
25
20
|
|
26
|
-
it "logs a yellow * on pending" do
|
27
|
-
subject.
|
28
|
-
|
21
|
+
it "logs a yellow * on pending results" do
|
22
|
+
subject.spec(pending_spec)
|
23
|
+
expect(@log).to eq("\e[33m*\e[0m")
|
29
24
|
end
|
30
25
|
|
31
|
-
it "logs a red F on
|
32
|
-
subject.
|
33
|
-
|
26
|
+
it "logs a red F on failing results" do
|
27
|
+
subject.spec(failing_spec)
|
28
|
+
expect(@log).to eq("\e[31mF\e[0m")
|
34
29
|
end
|
35
30
|
|
36
31
|
end
|
37
32
|
|
38
33
|
describe "#error" do
|
39
34
|
|
35
|
+
let(:result) { double(message: "_message_", trace: [{"file" => "http://127.0.0.1:31337/assets/path/file.js?foo=true&body=1", "line" => 42, "function" => "notAnAnonFunc"}]) }
|
36
|
+
|
40
37
|
it "logs the error" do
|
41
|
-
|
42
|
-
|
43
|
-
|
38
|
+
subject.error(result)
|
39
|
+
expect(@log).to eq("\e[31m_message_\e[0m\n\e[36m # path/file.js?foo=true:42 -- notAnAnonFunc\e[0m\n\n")
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#console" do
|
45
|
+
|
46
|
+
it "logs the message" do
|
47
|
+
subject.console("_message_\n")
|
48
|
+
expect(@log).to eq("_message_\n")
|
44
49
|
end
|
45
50
|
|
46
51
|
end
|
47
52
|
|
48
53
|
describe "#result" do
|
49
54
|
|
55
|
+
let(:result) { double(elapsed: 3.1337, coverage: nil) }
|
56
|
+
|
50
57
|
before do
|
51
|
-
subject.
|
58
|
+
subject.run_count = 666
|
52
59
|
end
|
53
60
|
|
54
61
|
describe "with no failures" do
|
55
62
|
|
56
|
-
it "logs the
|
57
|
-
subject.result(
|
58
|
-
expect(@log).to eq("\n\nFinished in
|
63
|
+
it "logs the stats" do
|
64
|
+
subject.result(result)
|
65
|
+
expect(@log).to eq("\n\nFinished in 3.1337 seconds\n\e[32m666 examples, 0 failures\e[0m\n")
|
59
66
|
end
|
60
67
|
|
61
68
|
end
|
62
69
|
|
63
70
|
describe "with failures" do
|
64
71
|
|
65
|
-
|
66
|
-
subject.failures <<
|
67
|
-
expect{
|
68
|
-
subject.result("elapsed" => 0.31337)
|
69
|
-
}.to raise_error(Teaspoon::Failure)
|
70
|
-
expect(@log).to eq("\n\nFailures:\n\n 1) full description some spec\n\e[31m Failure/Error: some message\n\n\e[0mFinished in 0.31337 seconds\n\e[31m666 examples, 1 failure\n\e[0m\nFailed examples:\n\n\e[31mteaspoon -s default --filter=\"full description\"\n\e[0m\n")
|
71
|
-
expect(subject.failures.length).to be(1)
|
72
|
+
before do
|
73
|
+
subject.failures << failing_spec
|
72
74
|
end
|
73
75
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
Teaspoon.configuration.should_receive(:fail_fast).and_return(false)
|
78
|
-
subject.failures << Teaspoon::Result.build_from_json("message" => "some message")
|
79
|
-
subject.result("elapsed" => 0.31337)
|
80
|
-
expect(subject.failures.length).to be(1)
|
81
|
-
end
|
82
|
-
|
76
|
+
it "logs the failures" do
|
77
|
+
subject.result(result)
|
78
|
+
expect(@log).to eq("\n\nFailures:\n\n 1) _description_\n\e[31m Failure/Error: _message_\n\e[0m\nFinished in 3.1337 seconds\n\e[31m666 examples, 1 failure\e[0m\n\nFailed examples:\n\n\e[31mteaspoon -s default --filter=\"_link_\"\e[0m\n")
|
83
79
|
end
|
84
80
|
|
85
81
|
end
|
86
82
|
|
87
83
|
describe "with pending" do
|
88
84
|
|
89
|
-
|
90
|
-
subject.pendings <<
|
91
|
-
|
92
|
-
|
85
|
+
before do
|
86
|
+
subject.pendings << pending_spec
|
87
|
+
end
|
88
|
+
|
89
|
+
it "logs the pending specs" do
|
90
|
+
subject.result(result)
|
91
|
+
expect(@log).to eq("\n\nPending:\n\e[33m _description_\e[0m\n\e[36m # Not yet implemented\n\e[0m\nFinished in 3.1337 seconds\n\e[33m666 examples, 0 failures, 1 pending\e[0m\n")
|
93
92
|
end
|
94
93
|
|
95
94
|
end
|
96
95
|
|
97
96
|
end
|
98
97
|
|
99
|
-
describe "#
|
98
|
+
describe "#coverage" do
|
100
99
|
|
101
|
-
it "
|
102
|
-
|
100
|
+
it "logs the coverage" do
|
101
|
+
subject.coverage("_text_\n\n_text_summary_")
|
102
|
+
expect(@log).to eq("\n_text_\n\n_text_summary_\n")
|
103
103
|
end
|
104
104
|
|
105
105
|
end
|
106
106
|
|
107
|
-
describe "#
|
107
|
+
describe "#threshold_failure" do
|
108
108
|
|
109
|
-
it "
|
110
|
-
|
111
|
-
|
109
|
+
it "logs the threshold failures" do
|
110
|
+
subject.threshold_failure("_was_not_met_\n_was_not_met_")
|
111
|
+
expect(@log).to eq("\e[31m\n_was_not_met_\n_was_not_met_\n\e[0m\n")
|
112
112
|
end
|
113
113
|
|
114
|
-
it "colorizes" do
|
115
|
-
STDOUT.should_receive(:print).with("\e[31mfoo\e[0m")
|
116
|
-
subject.send(:log, "foo", 31)
|
117
|
-
end
|
118
114
|
end
|
119
115
|
|
120
116
|
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Teaspoon::Formatters::JsonFormatter do
|
4
|
+
|
5
|
+
let(:hash) { {original_json: "_original_json_"} }
|
6
|
+
let(:result) { double(hash) }
|
7
|
+
|
8
|
+
describe "#runner" do
|
9
|
+
|
10
|
+
let(:result) { double(hash.merge(total: 42)) }
|
11
|
+
|
12
|
+
it "logs the original json" do
|
13
|
+
subject.should_receive(:log_result).with(result)
|
14
|
+
subject.runner(result)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#suite" do
|
20
|
+
|
21
|
+
it "logs the original json" do
|
22
|
+
subject.should_receive(:log_result).with(result)
|
23
|
+
subject.suite(result)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#spec" do
|
29
|
+
|
30
|
+
let(:result) { double(hash.merge(passing?: true)) }
|
31
|
+
|
32
|
+
it "logs the original json" do
|
33
|
+
subject.should_receive(:log_result).with(result)
|
34
|
+
subject.spec(result)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#error" do
|
40
|
+
|
41
|
+
it "logs the original json" do
|
42
|
+
subject.should_receive(:log_result).with(result)
|
43
|
+
subject.error(result)
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "#exception" do
|
49
|
+
|
50
|
+
it "logs the original json" do
|
51
|
+
subject.should_receive(:log_result).with(result)
|
52
|
+
subject.exception(result)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "#console" do
|
58
|
+
|
59
|
+
it "logs the message as json" do
|
60
|
+
subject.should_receive(:log_line).with(%Q{{"type":"console","log":"_message_"}})
|
61
|
+
subject.console("_message_")
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "#result" do
|
67
|
+
|
68
|
+
let(:result) { double(hash.merge(coverage: nil)) }
|
69
|
+
|
70
|
+
it "logs the original json" do
|
71
|
+
subject.should_receive(:log_str).with("_original_json_")
|
72
|
+
subject.result(result)
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
require "teaspoon/formatters/junit_formatter"
|
3
|
-
require "teaspoon/result"
|
4
2
|
|
5
3
|
describe Teaspoon::Formatters::JunitFormatter do
|
6
4
|
|
5
|
+
let(:passing_spec) { double(passing?: true, suite: "_suite_name_", label: "_passing_label_") }
|
6
|
+
let(:pending_spec) { double(passing?: false, pending?: true, suite: "_suite_name_", label: "_pending_label_") }
|
7
|
+
let(:failing_spec) { double(passing?: false, pending?: false, suite: "_suite_name_", label: "_failing&label_", message: "_failure_message_") }
|
8
|
+
|
7
9
|
before do
|
8
10
|
@log = ""
|
9
11
|
STDOUT.stub(:print) { |s| @log << s }
|
@@ -11,65 +13,100 @@ describe Teaspoon::Formatters::JunitFormatter do
|
|
11
13
|
|
12
14
|
describe "#runner" do
|
13
15
|
|
14
|
-
let(:
|
16
|
+
let(:result) { double(start: "_start_", total: 42) }
|
17
|
+
|
18
|
+
before do
|
19
|
+
subject.instance_variable_set(:@suite_name, "not_default")
|
20
|
+
end
|
15
21
|
|
16
|
-
it "
|
17
|
-
result = Teaspoon::Result.build_from_json(json)
|
18
|
-
subject.should_receive(:log).with("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
|
19
|
-
subject.should_receive(:log).with("<testsuites name=\"jasmine\"><testsuite name=\"\" tests=\"20\">")
|
22
|
+
it "starts the suite" do
|
20
23
|
subject.runner(result)
|
24
|
+
expect(@log).to eq(%Q{<?xml version="1.0" encoding="UTF-8"?>\n<testsuites name="Teaspoon">\n<testsuite name="not_default" tests="42" time="_start_">\n})
|
21
25
|
end
|
22
26
|
|
23
27
|
end
|
24
28
|
|
25
|
-
describe "#
|
29
|
+
describe "#suite" do
|
30
|
+
|
31
|
+
let(:result) { double(label: "_label_") }
|
26
32
|
|
27
|
-
|
33
|
+
it "calls #log_end_suite" do
|
34
|
+
subject.should_receive(:log_end_suite)
|
35
|
+
subject.suite(result)
|
36
|
+
end
|
28
37
|
|
29
|
-
|
38
|
+
it "logs the start of the testsuite" do
|
39
|
+
subject.suite(result)
|
40
|
+
expect(@log).to eq(%Q{<testsuite name="_label_">\n})
|
41
|
+
end
|
30
42
|
|
31
|
-
|
32
|
-
result = Teaspoon::Result.build_from_json(json)
|
33
|
-
subject.spec(result)
|
43
|
+
end
|
34
44
|
|
35
|
-
|
36
|
-
end
|
45
|
+
describe "#spec" do
|
37
46
|
|
47
|
+
it "logs a passing testcase on passing results" do
|
48
|
+
subject.spec(passing_spec)
|
49
|
+
expect(@log).to eq(%Q{<testcase classname="_suite_name_" name="_passing_label_">\n</testcase>\n})
|
38
50
|
end
|
39
51
|
|
40
|
-
|
52
|
+
it "logs a skipped testcase on pending results" do
|
53
|
+
subject.spec(pending_spec)
|
54
|
+
expect(@log).to eq(%Q{<testcase classname="_suite_name_" name="_pending_label_">\n <skipped/>\n</testcase>\n})
|
55
|
+
end
|
41
56
|
|
42
|
-
|
57
|
+
it "logs a failing testcase with the message on failing results" do
|
58
|
+
subject.spec(failing_spec)
|
59
|
+
expect(@log).to include(%Q{<testcase classname="_suite_name_" name="_failing&label_">\n})
|
60
|
+
expect(@log).to include(%Q{ <failure type="AssertionFailed">\n<![CDATA[\n_failure_message_\n]]>\n</failure>\n})
|
61
|
+
expect(@log).to include(%Q{</testcase>\n})
|
62
|
+
end
|
43
63
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
64
|
+
it "includes any stdout" do
|
65
|
+
subject.instance_variable_set(:@stdout, "_stdout_")
|
66
|
+
subject.spec(passing_spec)
|
67
|
+
expect(@log).to eq(%Q{<testcase classname="_suite_name_" name="_passing_label_">\n<system-out>\n<![CDATA[\n_stdout_\n]]>\n</system-out>\n</testcase>\n})
|
68
|
+
end
|
49
69
|
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "#result" do
|
73
|
+
|
74
|
+
let(:result) { double(coverage: nil) }
|
75
|
+
|
76
|
+
it "closes the last suite" do
|
77
|
+
subject.should_receive(:log_end_suite)
|
78
|
+
subject.result(result)
|
50
79
|
end
|
51
80
|
|
52
|
-
|
81
|
+
end
|
53
82
|
|
54
|
-
|
83
|
+
describe "#coverage" do
|
55
84
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
85
|
+
it "logs the coverage" do
|
86
|
+
subject.coverage("_text_\n\n_text_summary_")
|
87
|
+
expect(@log).to eq(%Q{<testsuite name="Coverage summary" tests="0">\n<properties>\n<![CDATA[\n_text_\n_text_summary_\n]]>\n<properties>\n</testsuite>\n})
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
63
91
|
|
92
|
+
describe "#threshold_failure" do
|
93
|
+
|
94
|
+
it "logs the threshold failures" do
|
95
|
+
subject.threshold_failure("_was_not_met_\n_was_not_met_")
|
96
|
+
expect(@log).to include(%Q{<testsuite name="Coverage thresholds" tests="1">\n})
|
97
|
+
expect(@log).to include(%Q{<testcase classname="Coverage thresholds" name="were not met">\n})
|
98
|
+
expect(@log).to include(%Q{ <failure type="AssertionFailed">\n<![CDATA[\n_was_not_met_\n_was_not_met_\n]]>\n</failure>\n})
|
99
|
+
expect(@log).to include(%Q{</testcase>\n})
|
100
|
+
expect(@log).to include(%Q{</testsuite>\n})
|
64
101
|
end
|
65
102
|
|
66
103
|
end
|
67
|
-
describe "#result" do
|
68
104
|
|
69
|
-
|
70
|
-
subject.result('result')
|
105
|
+
describe "#complete" do
|
71
106
|
|
72
|
-
|
107
|
+
it "logs the closing suite tags" do
|
108
|
+
subject.complete(2)
|
109
|
+
expect(@log).to include(%Q{</testsuite>\n</testsuites>})
|
73
110
|
end
|
74
111
|
|
75
112
|
end
|