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::PrideFormatter do
|
4
|
+
|
5
|
+
let(:passing_spec) { double(passing?: true) }
|
6
|
+
let(:pending_spec) { double(passing?: false, pending?: true) }
|
7
|
+
let(:failing_spec) { double(passing?: false, pending?: false) }
|
8
|
+
|
9
|
+
before do
|
10
|
+
@log = ""
|
11
|
+
STDOUT.stub(:print) { |s| @log << s }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#spec" do
|
15
|
+
|
16
|
+
it "logs a colorful . on passing results" do
|
17
|
+
subject.spec(passing_spec)
|
18
|
+
subject.spec(passing_spec)
|
19
|
+
subject.spec(passing_spec)
|
20
|
+
subject.spec(passing_spec)
|
21
|
+
subject.spec(passing_spec)
|
22
|
+
expect(@log).to eq("\e[38;5;154m.\e[0m\e[38;5;154m.\e[0m\e[38;5;148m.\e[0m\e[38;5;184m.\e[0m\e[38;5;184m.\e[0m")
|
23
|
+
end
|
24
|
+
|
25
|
+
it "logs a yellow * on pending results" do
|
26
|
+
subject.spec(pending_spec)
|
27
|
+
expect(@log).to eq("\e[33m*\e[0m")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "logs a red F on failing results" do
|
31
|
+
subject.spec(failing_spec)
|
32
|
+
expect(@log).to eq("\e[31mF\e[0m")
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
describe Teaspoon::Formatters::SnowdayFormatter do
|
6
|
+
|
7
|
+
let(:passing_spec) { double(passing?: true) }
|
8
|
+
let(:pending_spec) { double(passing?: false, pending?: true) }
|
9
|
+
let(:failing_spec) { double(passing?: false, pending?: false) }
|
10
|
+
|
11
|
+
before do
|
12
|
+
@log = ""
|
13
|
+
STDOUT.stub(:print) { |s| @log << s }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#spec" do
|
17
|
+
|
18
|
+
it "logs a snowy snowman on passing results" do
|
19
|
+
subject.spec(passing_spec)
|
20
|
+
expect(@log).to eq("\e[36m☃\e[0m")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "logs a yellow sadface on pending results" do
|
24
|
+
subject.spec(pending_spec)
|
25
|
+
expect(@log).to eq("\e[33m☹\e[0m")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "logs a red skull and crossbones on failing results" do
|
29
|
+
subject.spec(failing_spec)
|
30
|
+
expect(@log).to eq("\e[31m☠\e[0m")
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
require "teaspoon/formatters/tap_formatter"
|
3
|
-
require "teaspoon/result"
|
4
2
|
|
5
3
|
describe Teaspoon::Formatters::TapFormatter do
|
6
4
|
|
5
|
+
let(:passing_spec) { double(passing?: true, description: "_passing_desc_") }
|
6
|
+
let(:pending_spec) { double(passing?: false, pending?: true, description: "_pending_desc_") }
|
7
|
+
let(:failing_spec) { double(passing?: false, pending?: false, description: "_failing_desc_", message: "_failure_message_") }
|
8
|
+
|
7
9
|
before do
|
8
10
|
@log = ""
|
9
11
|
STDOUT.stub(:print) { |s| @log << s }
|
@@ -11,114 +13,60 @@ describe Teaspoon::Formatters::TapFormatter do
|
|
11
13
|
|
12
14
|
describe "#runner" do
|
13
15
|
|
14
|
-
let(:
|
16
|
+
let(:result) { double(total: 42) }
|
15
17
|
|
16
|
-
it "logs the
|
17
|
-
result = Teaspoon::Result.build_from_json(json)
|
18
|
-
subject.should_receive(:log).with("1..20")
|
18
|
+
it "logs the total count" do
|
19
19
|
subject.runner(result)
|
20
|
+
expect(@log).to eq("1..42\n")
|
20
21
|
end
|
21
22
|
|
22
23
|
end
|
23
24
|
|
24
25
|
describe "#spec" do
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
it "calls passing_spec" do
|
31
|
-
result = Teaspoon::Result.build_from_json(json)
|
32
|
-
subject.should_receive(:passing_spec)
|
33
|
-
subject.spec(result)
|
34
|
-
end
|
35
|
-
|
27
|
+
it "logs an ok on passing results" do
|
28
|
+
subject.spec(passing_spec)
|
29
|
+
expect(@log).to eq("ok 1 - _passing_desc_\n")
|
36
30
|
end
|
37
31
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
it "calls pending_spec" do
|
43
|
-
result = Teaspoon::Result.build_from_json(json)
|
44
|
-
subject.should_receive(:pending_spec)
|
45
|
-
subject.spec(result)
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
describe "failing spec" do
|
51
|
-
|
52
|
-
let(:json) { {"status" => "fail"} }
|
53
|
-
|
54
|
-
it "calls failing_spec" do
|
55
|
-
result = Teaspoon::Result.build_from_json(json)
|
56
|
-
subject.should_receive(:failing_spec)
|
57
|
-
subject.spec(result)
|
58
|
-
end
|
59
|
-
|
32
|
+
it "logs an ok but [pending] on pending results" do
|
33
|
+
subject.spec(pending_spec)
|
34
|
+
expect(@log).to eq("ok 1 - [pending] _pending_desc_\n")
|
60
35
|
end
|
61
36
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
it "keeps count" do
|
67
|
-
expect(subject.errors.size).to be(0)
|
68
|
-
subject.error("foo")
|
69
|
-
expect(subject.errors.size).to be(1)
|
37
|
+
it "logs a not ok on failing results" do
|
38
|
+
subject.spec(failing_spec)
|
39
|
+
expect(@log).to eq("not ok 1 - _failing_desc_\n FAIL _failure_message_\n")
|
70
40
|
end
|
71
41
|
|
72
42
|
end
|
73
43
|
|
74
|
-
describe "#
|
75
|
-
|
76
|
-
let(:json) { {"suite" => "_suite_", "label" => "_label_"} }
|
44
|
+
describe "#console" do
|
77
45
|
|
78
|
-
it "logs the
|
79
|
-
|
80
|
-
subject.
|
81
|
-
|
82
|
-
subject.instance_variable_set(:@result, result)
|
83
|
-
subject.send(:passing_spec)
|
46
|
+
it "logs the message" do
|
47
|
+
subject.console("_message1_")
|
48
|
+
subject.console("_message2_\n")
|
49
|
+
expect(@log).to eq("# _message1_\n# _message2_\n")
|
84
50
|
end
|
85
51
|
|
86
52
|
end
|
87
53
|
|
88
|
-
describe "#
|
89
|
-
|
90
|
-
let(:json) { {"suite" => "_suite_", "label" => "_label_"} }
|
54
|
+
describe "#coverage" do
|
91
55
|
|
92
|
-
it "logs the
|
93
|
-
|
94
|
-
|
95
|
-
subject.instance_variable_set(:@total, 42)
|
96
|
-
subject.instance_variable_set(:@result, result)
|
97
|
-
subject.send(:pending_spec)
|
56
|
+
it "logs the coverage" do
|
57
|
+
subject.coverage("_text_\n\n_text_summary_")
|
58
|
+
expect(@log).to eq("# _text_\n# \n# _text_summary_\n")
|
98
59
|
end
|
99
60
|
|
100
61
|
end
|
101
62
|
|
102
|
-
describe "#
|
63
|
+
describe "#threshold_failure" do
|
103
64
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
result = Teaspoon::Result.build_from_json(json)
|
108
|
-
subject.should_receive(:log).with("not ok 42 - _suite_ _label_\n # FAIL _message_")
|
109
|
-
subject.instance_variable_set(:@total, 42)
|
110
|
-
subject.instance_variable_set(:@result, result)
|
111
|
-
subject.send(:failing_spec)
|
65
|
+
it "logs the threshold failures" do
|
66
|
+
subject.threshold_failure("_was_not_met_\n_was_not_met_")
|
67
|
+
expect(@log).to eq("not ok 1 - Coverage threshold failed\n# _was_not_met_\n# _was_not_met_\n")
|
112
68
|
end
|
113
69
|
|
114
70
|
end
|
115
71
|
|
116
|
-
describe "#log" do
|
117
|
-
|
118
|
-
it "calls STDOUT.print" do
|
119
|
-
STDOUT.should_receive(:print).with("foo\n")
|
120
|
-
subject.send(:log, "foo")
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
72
|
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
require "teaspoon/formatters/tap_y_formatter"
|
3
|
-
require "teaspoon/result"
|
4
2
|
|
5
3
|
describe Teaspoon::Formatters::TapYFormatter do
|
6
4
|
|
5
|
+
let(:passing_spec) { double(passing?: true, label: "_passing_label_") }
|
6
|
+
let(:pending_spec) { double(passing?: false, pending?: true, label: "_pending_label_", message: "_message_") }
|
7
|
+
let(:failing_spec) { double(passing?: false, pending?: false, label: "_failing_label_", message: "_message_", link: "_link_") }
|
8
|
+
|
7
9
|
before do
|
8
10
|
@log = ""
|
9
11
|
STDOUT.stub(:print) { |s| @log << s }
|
@@ -11,180 +13,68 @@ describe Teaspoon::Formatters::TapYFormatter do
|
|
11
13
|
|
12
14
|
describe "#runner" do
|
13
15
|
|
14
|
-
let(:
|
16
|
+
let(:result) { double(start: "_start_", total: 42) }
|
15
17
|
|
16
18
|
it "logs the information" do
|
17
|
-
result = Teaspoon::Result.build_from_json(json)
|
18
|
-
subject.should_receive(:log).with(
|
19
|
-
"type" => "suite",
|
20
|
-
"start" => "_start_",
|
21
|
-
"count" => 20,
|
22
|
-
"seed" => 0,
|
23
|
-
"rev" => 4
|
24
|
-
)
|
25
19
|
subject.runner(result)
|
20
|
+
expect(@log).to eq("---\ntype: suite\nstart: _start_\ncount: 42\nseed: 0\nrev: 4\n")
|
26
21
|
end
|
27
22
|
|
28
23
|
end
|
29
24
|
|
30
25
|
describe "#suite" do
|
31
26
|
|
32
|
-
let(:
|
27
|
+
let(:result) { double(label: "_label_", level: 1) }
|
33
28
|
|
34
29
|
it "logs the information" do
|
35
|
-
result = Teaspoon::Result.build_from_json(json)
|
36
|
-
subject.should_receive(:log).with(
|
37
|
-
"type" => "case",
|
38
|
-
"label" => "_label_",
|
39
|
-
"level" => 1
|
40
|
-
)
|
41
30
|
subject.suite(result)
|
31
|
+
expect(@log).to eq("---\ntype: case\nlabel: _label_\nlevel: 1\n")
|
42
32
|
end
|
43
33
|
|
44
34
|
end
|
45
35
|
|
46
36
|
describe "#spec" do
|
47
37
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
it "calls passing_spec" do
|
53
|
-
result = Teaspoon::Result.build_from_json(json)
|
54
|
-
subject.should_receive(:passing_spec)
|
55
|
-
subject.spec(result)
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
describe "pending spec" do
|
61
|
-
|
62
|
-
let(:json) { {"status" => "pending"} }
|
63
|
-
|
64
|
-
it "calls pending_spec" do
|
65
|
-
result = Teaspoon::Result.build_from_json(json)
|
66
|
-
subject.should_receive(:pending_spec)
|
67
|
-
subject.spec(result)
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
describe "failing spec" do
|
73
|
-
|
74
|
-
let(:json) { {"status" => "fail"} }
|
75
|
-
|
76
|
-
it "calls failing_spec" do
|
77
|
-
result = Teaspoon::Result.build_from_json(json)
|
78
|
-
subject.should_receive(:failing_spec)
|
79
|
-
subject.spec(result)
|
80
|
-
end
|
81
|
-
|
38
|
+
it "calls passing_spec passing results" do
|
39
|
+
subject.spec(passing_spec)
|
40
|
+
expect(@log).to eq("---\ntype: test\nstatus: pass\nlabel: _passing_label_\nstdout: ''\n")
|
82
41
|
end
|
83
42
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
let(:json) { {"elapsed" => "0.00666"} }
|
89
|
-
|
90
|
-
it "logs the information" do
|
91
|
-
result = Teaspoon::Result.build_from_json(json)
|
92
|
-
subject.should_receive(:log).with(
|
93
|
-
"type" => "final",
|
94
|
-
"time" => "0.00666",
|
95
|
-
"counts" => {
|
96
|
-
"total" => 0,
|
97
|
-
"pass" => 0,
|
98
|
-
"fail" => 0,
|
99
|
-
"error" => 0,
|
100
|
-
"omit" => 0,
|
101
|
-
"todo" => 0
|
102
|
-
}
|
103
|
-
)
|
104
|
-
subject.result(result)
|
43
|
+
it "calls pending_spec on pending results" do
|
44
|
+
subject.spec(pending_spec)
|
45
|
+
expect(@log).to eq("---\ntype: test\nstatus: pending\nlabel: _pending_label_\nstdout: ''\nexception:\n message: _message_\n")
|
105
46
|
end
|
106
47
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
it "keeps count" do
|
112
|
-
expect(subject.errors.size).to be(0)
|
113
|
-
subject.error("foo")
|
114
|
-
expect(subject.errors.size).to be(1)
|
48
|
+
it "calls failing_spec on failing results" do
|
49
|
+
subject.spec(failing_spec)
|
50
|
+
expect(@log).to eq("---\ntype: test\nstatus: fail\nlabel: _failing_label_\nstdout: ''\nexception:\n message: _message_\n backtrace:\n - _link_#:0\n file: unknown\n line: unknown\n source: unknown\n snippet:\n '0': _link_\n class: Unknown\n")
|
115
51
|
end
|
116
52
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
let(:json) { {"label" => "_label_"} }
|
122
|
-
|
123
|
-
it "logs the information" do
|
124
|
-
result = Teaspoon::Result.build_from_json(json)
|
125
|
-
subject.should_receive(:log).with(
|
126
|
-
"type" => "test",
|
127
|
-
"status" => "pass",
|
128
|
-
"label" => "_label_"
|
129
|
-
)
|
130
|
-
subject.instance_variable_set(:@result, result)
|
131
|
-
subject.send(:passing_spec)
|
53
|
+
it "provides the stdout" do
|
54
|
+
subject.instance_variable_set(:@stdout, "_stdout_")
|
55
|
+
subject.spec(passing_spec)
|
56
|
+
expect(@log).to eq("---\ntype: test\nstatus: pass\nlabel: _passing_label_\nstdout: _stdout_\n")
|
132
57
|
end
|
133
58
|
|
134
59
|
end
|
135
60
|
|
136
|
-
describe "#
|
61
|
+
describe "#result" do
|
137
62
|
|
138
|
-
let(:
|
63
|
+
let(:result) { double(elapsed: 3.1337, coverage: nil) }
|
139
64
|
|
140
|
-
|
141
|
-
|
142
|
-
subject.
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
"exception" => {
|
147
|
-
"message" => "_message_"
|
148
|
-
}
|
149
|
-
)
|
150
|
-
subject.instance_variable_set(:@result, result)
|
151
|
-
subject.send(:pending_spec)
|
65
|
+
before do
|
66
|
+
subject.run_count = 6
|
67
|
+
subject.passes = [1, 2]
|
68
|
+
subject.failures = [1]
|
69
|
+
subject.errors = [1]
|
70
|
+
subject.pendings = [1, 2]
|
152
71
|
end
|
153
72
|
|
154
|
-
end
|
155
|
-
|
156
|
-
describe "#failing_spec" do
|
157
|
-
|
158
|
-
let(:json) { {"label" => "_label_", "link" => "_link_", "message" => "_message_"} }
|
159
|
-
|
160
73
|
it "logs the information" do
|
161
|
-
result
|
162
|
-
|
163
|
-
"type" => "test",
|
164
|
-
"status" => "fail",
|
165
|
-
"label" => "_label_",
|
166
|
-
"exception" => {
|
167
|
-
"message" => "_message_",
|
168
|
-
"backtrace" => ["_link_#:0"],
|
169
|
-
"file" => "unknown",
|
170
|
-
"line" => "unknown",
|
171
|
-
"source" => "unknown",
|
172
|
-
"snippet" => {"0" => "_link_"},
|
173
|
-
"class" => "Unknown"
|
174
|
-
}
|
175
|
-
)
|
176
|
-
subject.instance_variable_set(:@result, result)
|
177
|
-
subject.send(:failing_spec)
|
74
|
+
subject.result(result)
|
75
|
+
expect(@log).to eq("---\ntype: final\ntime: 3.1337\ncounts:\n total: 6\n pass: 2\n fail: 1\n error: 1\n omit: 0\n todo: 2\n")
|
178
76
|
end
|
179
77
|
|
180
78
|
end
|
181
79
|
|
182
|
-
describe "#log" do
|
183
|
-
|
184
|
-
it "calls STDOUT.print" do
|
185
|
-
STDOUT.should_receive(:print).with(%{---\nfoo: bar\n})
|
186
|
-
subject.send(:log, "foo" => "bar")
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
80
|
end
|