teabag 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +40 -13
- data/app/assets/javascripts/teabag-jasmine.js +75 -38
- data/lib/generators/teabag/install/templates/env.rb +3 -2
- data/lib/teabag/command_line.rb +4 -0
- data/lib/teabag/configuration.rb +3 -2
- data/lib/teabag/formatters/base_formatter.rb +6 -1
- data/lib/teabag/formatters/tap_formatter.rb +47 -0
- data/lib/teabag/instrumentation.rb +1 -1
- data/lib/teabag/runner.rb +11 -1
- data/lib/teabag/server.rb +2 -1
- data/lib/teabag/version.rb +1 -1
- data/spec/dummy/log/development.log +11151 -0
- data/spec/dummy/log/test.log +1359 -0
- data/spec/dummy/tmp/cache/assets/C35/A30/sprockets%2F29906bf540f7d2e081088494b2554989 +0 -0
- data/spec/dummy/tmp/cache/assets/C4E/9B0/sprockets%2Fa807397434c9262c3d62da3e91152184 +0 -0
- data/spec/dummy/tmp/cache/assets/C59/250/sprockets%2Fa80d3fe493d2476e58c4323996064512 +0 -0
- data/spec/dummy/tmp/cache/assets/C75/D50/sprockets%2F5302968a40e08d2c011aa38666d273f6 +0 -0
- data/spec/dummy/tmp/cache/assets/C78/F80/sprockets%2F9161622ddd251097a4ab816b8220984c +0 -0
- data/spec/dummy/tmp/cache/assets/C7A/EC0/sprockets%2F5c16e4214f5662e1b27932a57c43491b +0 -0
- data/spec/dummy/tmp/cache/assets/C89/700/sprockets%2F259935a7704fef0069303ea63fa89408 +0 -0
- data/spec/dummy/tmp/cache/assets/C8A/460/sprockets%2F77bffd9959420103906722b404ae8d59 +0 -0
- data/spec/dummy/tmp/cache/assets/C91/FA0/sprockets%2F2eb81283f5789ae91a69344552db3856 +0 -0
- data/spec/dummy/tmp/cache/assets/C9D/E90/sprockets%2F3045c9533f179d3e1c805d163ed002a0 +0 -0
- data/spec/dummy/tmp/cache/assets/CA6/DF0/sprockets%2F7da83747ce56e49393b6b8726587f846 +0 -0
- data/spec/dummy/tmp/cache/assets/CA9/C40/sprockets%2F932b7e2cd1e067289ab51190800814df +0 -0
- data/spec/dummy/tmp/cache/assets/CAA/0C0/sprockets%2F057b0ce384f16d9202ae84473436cc35 +0 -0
- data/spec/dummy/tmp/cache/assets/CAD/410/sprockets%2F651414e5c7e86f05c5108dc71626b25c +0 -0
- data/spec/dummy/tmp/cache/assets/CAF/0F0/sprockets%2F6000e67cf3f2377f860c24da7c819701 +0 -0
- data/spec/dummy/tmp/cache/assets/CB0/700/sprockets%2F006af6bf0f6b55777b03c4615c853881 +0 -0
- data/spec/dummy/tmp/cache/assets/CB1/B50/sprockets%2F44b5b96ee7652d66a217a1756431c4a8 +0 -0
- data/spec/dummy/tmp/cache/assets/CB5/E60/sprockets%2Ff0f2b623b42840839e37f5ed055f5482 +0 -0
- data/spec/dummy/tmp/cache/assets/CBB/FA0/sprockets%2F74922109263bdc965b2e9567eec6d154 +0 -0
- data/spec/dummy/tmp/cache/assets/CBD/AF0/sprockets%2Fd687ec33822256e9444e8cd04f1b4873 +0 -0
- data/spec/dummy/tmp/cache/assets/CBF/630/sprockets%2F707d2db81468088470d476abff35388d +0 -0
- data/spec/dummy/tmp/cache/assets/CC2/EC0/sprockets%2F76bf80cb571ca530357f78db78167866 +0 -0
- data/spec/dummy/tmp/cache/assets/CCE/C50/sprockets%2Fe12774c2fea852112414bb379a71f31a +0 -0
- data/spec/dummy/tmp/cache/assets/CD3/460/sprockets%2F7f3f6802b0b309ed142d0b671c9640c4 +0 -0
- data/spec/dummy/tmp/cache/assets/CD7/A40/sprockets%2Fa1c29a904e41680053e79b63a14cfa58 +0 -0
- data/spec/dummy/tmp/cache/assets/CD9/DD0/sprockets%2Fe5774759168a731da1c1149ecf0e1b03 +0 -0
- data/spec/dummy/tmp/cache/assets/CE0/090/sprockets%2F48d5d35ae87d0723318b8bc257fa2237 +0 -0
- data/spec/dummy/tmp/cache/assets/CE3/1F0/sprockets%2Fe69a515d3a9d14c669be8871012a7d07 +0 -0
- data/spec/dummy/tmp/cache/assets/CE6/270/sprockets%2F2c98152560d18470fec8cf4c6829b4d0 +0 -0
- data/spec/dummy/tmp/cache/assets/CE6/7C0/sprockets%2Fa03a2c86ce6724be8542295e1cf24798 +0 -0
- data/spec/dummy/tmp/cache/assets/CE7/A60/sprockets%2Ff58eee249aa167d23f8220087bb46684 +0 -0
- data/spec/dummy/tmp/cache/assets/CE9/9E0/sprockets%2F135480d497ed7e4884462dc0ef0b80d7 +0 -0
- data/spec/dummy/tmp/cache/assets/CEB/680/sprockets%2F67f0794ef8c0576d5c7da34f4437305a +0 -0
- data/spec/dummy/tmp/cache/assets/CEB/B40/sprockets%2F1150bf8d912aa100a132251eefaf6045 +0 -0
- data/spec/dummy/tmp/cache/assets/CF4/6C0/sprockets%2F087d4a99adae6d6972937a2e57e93504 +0 -0
- data/spec/dummy/tmp/cache/assets/CF4/6F0/sprockets%2Fed96f92571224b862b84d7078b86ded3 +0 -0
- data/spec/dummy/tmp/cache/assets/CF8/780/sprockets%2F8845b81ff27cdb57c835836c9f91a265 +0 -0
- data/spec/dummy/tmp/cache/assets/CFA/D20/sprockets%2Fb26796b39b3c5d6ed70be7989637a493 +0 -0
- data/spec/dummy/tmp/cache/assets/CFC/380/sprockets%2Fa7443cbd671446a589867dd5f4a4f989 +0 -0
- data/spec/dummy/tmp/cache/assets/D00/110/sprockets%2F6a6353b7723a8b21708e0fbfe04bd422 +0 -0
- data/spec/dummy/tmp/cache/assets/D03/630/sprockets%2F5d8da32dba6a7be70426a1d554773701 +0 -0
- data/spec/dummy/tmp/cache/assets/D04/170/sprockets%2F76ab1dc02e6c7618852708a1e05a2df3 +0 -0
- data/spec/dummy/tmp/cache/assets/D04/480/sprockets%2F8bd8f10500b21d2f9d94e4cd1401c936 +0 -0
- data/spec/dummy/tmp/cache/assets/D05/8D0/sprockets%2F319f8f235f452343f1ebf03cb262d23d +0 -0
- data/spec/dummy/tmp/cache/assets/D09/BF0/sprockets%2F9e6bca5d26f50d9484385d51ba04312c +0 -0
- data/spec/dummy/tmp/cache/assets/D0E/570/sprockets%2F90fe371bf8091e88a712124d9cdae260 +0 -0
- data/spec/dummy/tmp/cache/assets/D15/750/sprockets%2F8effdd3e668a4036260a3e370f3b6657 +0 -0
- data/spec/dummy/tmp/cache/assets/D17/710/sprockets%2Ffa49fb6823d466e79a195e0cd71340c5 +0 -0
- data/spec/dummy/tmp/cache/assets/D1A/D30/sprockets%2F815a5177e9edba0c5c996182ef1b3675 +0 -0
- data/spec/dummy/tmp/cache/assets/D1D/560/sprockets%2F1ca784ee7ba1922465147e7f8963eae5 +0 -0
- data/spec/dummy/tmp/cache/assets/D1E/AA0/sprockets%2F5c8741a556bc955cd36e61c88582b6dc +0 -0
- data/spec/dummy/tmp/cache/assets/D31/9C0/sprockets%2Fbd102a4f5a4985c3519dd6ab0295a1c6 +0 -0
- data/spec/dummy/tmp/cache/assets/D35/7C0/sprockets%2Ff536a2606eaf7d542c0985104cb62baf +0 -0
- data/spec/dummy/tmp/cache/assets/D37/FF0/sprockets%2F96841ca4cfae32c515077f3f5fc303b2 +0 -0
- data/spec/dummy/tmp/cache/assets/D3C/840/sprockets%2Fc6202ec91d567a85bd3d46dc43ea9108 +0 -0
- data/spec/dummy/tmp/cache/assets/D44/E90/sprockets%2F05cfc0bf7c9938963d1d1c63248db80d +0 -0
- data/spec/dummy/tmp/cache/assets/D45/C30/sprockets%2Fcc744877558178a3adb77c441cadce70 +0 -0
- data/spec/dummy/tmp/cache/assets/D47/A90/sprockets%2Fe7ca382b607c595ea6505853f7fb63da +0 -0
- data/spec/dummy/tmp/cache/assets/D49/1F0/sprockets%2F773b56f87127c6605e7d1d3faf2b6af6 +0 -0
- data/spec/dummy/tmp/cache/assets/D49/A10/sprockets%2Fc4656bd995a6f297c26d19b13aadb963 +0 -0
- data/spec/dummy/tmp/cache/assets/D51/400/sprockets%2Ff5e433d8a31e80985b75ce598de236be +0 -0
- data/spec/dummy/tmp/cache/assets/D54/D80/sprockets%2F631327e25ec20edc723046cdec3bb1c0 +0 -0
- data/spec/dummy/tmp/cache/assets/D5C/710/sprockets%2F9427d05cee2caa721241a25a9af1d08f +0 -0
- data/spec/dummy/tmp/cache/assets/D5C/CC0/sprockets%2Faa8bf6de211f2765b0a26f112b971f0c +0 -0
- data/spec/dummy/tmp/cache/assets/D5E/FA0/sprockets%2Fc81c371ae2d61a6aa1708262fba79e0d +0 -0
- data/spec/dummy/tmp/cache/assets/D61/1F0/sprockets%2F0c7a6176d2fc4db00bb9a74d36380fe1 +0 -0
- data/spec/dummy/tmp/cache/assets/D67/BC0/sprockets%2F35d2c2b45981ade5a2db2a9c7f37a615 +0 -0
- data/spec/dummy/tmp/cache/assets/D69/F90/sprockets%2F6a0795b7b38bd7e6142cd1b88211dade +0 -0
- data/spec/dummy/tmp/cache/assets/D6A/950/sprockets%2F429b1806cb7580ebf29f9a12c33cbea6 +0 -0
- data/spec/dummy/tmp/cache/assets/D6B/890/sprockets%2Fe1317822fdcc5580f1e50c9b91c6e5bb +0 -0
- data/spec/dummy/tmp/cache/assets/D6D/DA0/sprockets%2Fac936bf40b42227a2bf9d474ae9ec149 +0 -0
- data/spec/dummy/tmp/cache/assets/D77/B30/sprockets%2F946cf2f17c7eb41037f9ee08ad67ec40 +0 -0
- data/spec/dummy/tmp/cache/assets/D78/2F0/sprockets%2F3c61f8915b8f717b1de788e6ecad122c +0 -0
- data/spec/dummy/tmp/cache/assets/D7E/C10/sprockets%2F747c98c3cc7494a62dd882752adffb2b +0 -0
- data/spec/dummy/tmp/cache/assets/D8C/520/sprockets%2F221cd58a042baac534d27e4cfedc1188 +0 -0
- data/spec/dummy/tmp/cache/assets/D93/BD0/sprockets%2Ff5e1b60201e08e3ddf8d3de5211f3d5e +0 -0
- data/spec/dummy/tmp/cache/assets/DA0/330/sprockets%2Fcbbb4de706387d50f48a72ee6c9c1b80 +0 -0
- data/spec/dummy/tmp/cache/assets/DA4/320/sprockets%2F7fd0ad444f4a16b359bdbfe0977bb874 +0 -0
- data/spec/dummy/tmp/cache/assets/DA5/0A0/sprockets%2F7a4b5928cec69ab65afff309a04d6b47 +0 -0
- data/spec/dummy/tmp/cache/assets/DAD/1F0/sprockets%2Fdf7609630657aee0ebe5ed61e929d5dd +0 -0
- data/spec/dummy/tmp/cache/assets/DAE/6C0/sprockets%2F77c7a8676aeefa73156c55dfcf51cc46 +0 -0
- data/spec/dummy/tmp/cache/assets/DBC/A20/sprockets%2Fec46fb30cecc002128c61fb49cf30da8 +0 -0
- data/spec/dummy/tmp/cache/assets/DC4/CA0/sprockets%2Fdbcd5b5132f1ec3ff0e7e7db19190f03 +0 -0
- data/spec/dummy/tmp/cache/assets/DC7/A10/sprockets%2F84a8af0fcbf401864e1ae5bf092cba94 +0 -0
- data/spec/dummy/tmp/cache/assets/DE4/140/sprockets%2F139e4ab85d1aacb22c115fa136afdc8a +0 -0
- data/spec/dummy/tmp/cache/assets/DEB/110/sprockets%2F2dbdab0ce5babca645cdb5780004f875 +0 -0
- data/spec/dummy/tmp/cache/assets/DF7/E10/sprockets%2F25e4253aba9a9adcefb72552fb1ff0c8 +0 -0
- data/spec/dummy/tmp/cache/assets/DFC/C20/sprockets%2Fd9178ad7e3b401c9fceafd64ea2b50d6 +0 -0
- data/spec/dummy/tmp/cache/assets/DFC/C30/sprockets%2Fb50a07cb30b0bd0eec8e98e5de79d65d +0 -0
- data/spec/dummy/tmp/cache/assets/E02/6E0/sprockets%2F63d6a5cdb8cefa64ef76b5c6e0fd3720 +0 -0
- data/spec/dummy/tmp/cache/assets/E08/BB0/sprockets%2Fefac99af1af28543aef6fb607faa4973 +0 -0
- data/spec/dummy/tmp/cache/assets/E08/F20/sprockets%2F4fc5cdcd6974efe7adfe809b30bd6513 +0 -0
- data/spec/dummy/tmp/cache/assets/E16/D30/sprockets%2Fd69469e6e7439baacd8df989c0fdacc2 +0 -0
- data/spec/dummy/tmp/cache/assets/E17/EF0/sprockets%2Fa291ad64a26afd055dfadabbdf03f154 +0 -0
- data/spec/dummy/tmp/cache/assets/E2F/790/sprockets%2F7fac280deaa7ef20a77d5c9b5b9cfc34 +0 -0
- data/spec/dummy/tmp/cache/assets/E36/A40/sprockets%2Ff3477eebd69a4f1b8fbdd3f9ef2ba242 +0 -0
- data/spec/dummy/tmp/cache/assets/E41/250/sprockets%2F97cf8fe3d7ffaff076f655aefb36da03 +0 -0
- data/spec/dummy/tmp/cache/assets/E64/1E0/sprockets%2F81ab4c863fbbdec8dd66afc97ebf034d +0 -0
- data/spec/dummy/tmp/cache/assets/E6E/260/sprockets%2Fd9f8ab8b91ef582cc6c99a3ba0dedfe6 +0 -0
- data/spec/dummy/tmp/cache/assets/F79/360/sprockets%2F0ce035fefee5ebdabc8efabfbdbd6ee4 +0 -0
- data/spec/spec_helper.rb +2 -2
- data/spec/teabag/configuration_spec.rb +4 -0
- data/spec/teabag/formatters/base_formatter_spec.rb +1 -1
- data/spec/teabag/formatters/tap_formatter_spec.rb +124 -0
- data/spec/teabag/instrumentation_spec.rb +7 -4
- data/spec/teabag/runner_spec.rb +27 -3
- data/spec/teabag/server_spec.rb +20 -0
- metadata +11 -4
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/spec/spec_helper.rb
CHANGED
@@ -5,14 +5,14 @@ require File.expand_path("../dummy/config/environment", __FILE__)
|
|
5
5
|
require "rspec/rails"
|
6
6
|
require "rspec/autorun"
|
7
7
|
require "capybara/rails"
|
8
|
-
require 'capybara/poltergeist'
|
8
|
+
#require 'capybara/poltergeist'
|
9
9
|
require "aruba/api"
|
10
10
|
|
11
11
|
require "ostruct"
|
12
12
|
|
13
13
|
Dir[File.expand_path("../support/**/*.rb", __FILE__)].each { |f| require f }
|
14
14
|
|
15
|
-
Capybara.javascript_driver = :poltergeist
|
15
|
+
#Capybara.javascript_driver = :poltergeist
|
16
16
|
|
17
17
|
RSpec.configure do |config|
|
18
18
|
config.infer_base_class_for_anonymous_controllers = false
|
@@ -46,6 +46,7 @@ describe Teabag::Configuration do
|
|
46
46
|
after do
|
47
47
|
Teabag::Configuration.mount_at = "/teabag"
|
48
48
|
Teabag::Configuration.suites.delete("test_suite")
|
49
|
+
Teabag::Configuration.server = nil
|
49
50
|
end
|
50
51
|
|
51
52
|
it "has the default configuration" do
|
@@ -60,11 +61,14 @@ describe Teabag::Configuration do
|
|
60
61
|
expect(subject.suites).to be_a(Hash)
|
61
62
|
expect(subject.coverage).to eq(false)
|
62
63
|
expect(subject.coverage_reports).to eq(["text-summary"])
|
64
|
+
expect(subject.server).to be_nil
|
63
65
|
end
|
64
66
|
|
65
67
|
it "allows setting various configuration options" do
|
66
68
|
Teabag.configuration.mount_at = "/teabags_are_awesome"
|
67
69
|
expect(subject.mount_at).to eq("/teabags_are_awesome")
|
70
|
+
Teabag.configuration.server = :webrick
|
71
|
+
expect(subject.server).to eq(:webrick)
|
68
72
|
end
|
69
73
|
|
70
74
|
it "allows defining suites" do
|
@@ -34,7 +34,7 @@ describe Teabag::Formatters::BaseFormatter do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it "doesn't log when suppressing logs" do
|
37
|
-
|
37
|
+
subject.should_receive(:suppress_logs?).and_return(true)
|
38
38
|
Teabag::Coverage.should_not_receive(:new)
|
39
39
|
subject.send(:log_coverage, "_data_")
|
40
40
|
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "teabag/formatters/tap_formatter"
|
3
|
+
require "teabag/result"
|
4
|
+
|
5
|
+
describe Teabag::Formatters::TapFormatter do
|
6
|
+
|
7
|
+
before do
|
8
|
+
@log = ""
|
9
|
+
STDOUT.stub(:print) { |s| @log << s }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#runner" do
|
13
|
+
|
14
|
+
let(:json) { {"start" => "_start_", "total" => 20} }
|
15
|
+
|
16
|
+
it "logs the information" do
|
17
|
+
result = Teabag::Result.build_from_json(json)
|
18
|
+
subject.should_receive(:log).with("1..20")
|
19
|
+
subject.runner(result)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#spec" do
|
25
|
+
|
26
|
+
describe "passing spec" do
|
27
|
+
|
28
|
+
let(:json) { {"status" => "passed"} }
|
29
|
+
|
30
|
+
it "calls passing_spec" do
|
31
|
+
result = Teabag::Result.build_from_json(json)
|
32
|
+
subject.should_receive(:passing_spec)
|
33
|
+
subject.spec(result)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "pending spec" do
|
39
|
+
|
40
|
+
let(:json) { {"status" => "pending"} }
|
41
|
+
|
42
|
+
it "calls pending_spec" do
|
43
|
+
result = Teabag::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 = Teabag::Result.build_from_json(json)
|
56
|
+
subject.should_receive(:failing_spec)
|
57
|
+
subject.spec(result)
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "#error" do
|
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)
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
describe "#passing_spec" do
|
75
|
+
|
76
|
+
let(:json) { {"suite" => "_suite_", "label" => "_label_"} }
|
77
|
+
|
78
|
+
it "logs the information" do
|
79
|
+
result = Teabag::Result.build_from_json(json)
|
80
|
+
subject.should_receive(:log).with("ok 42 - _suite_ _label_")
|
81
|
+
subject.instance_variable_set(:@total, 42)
|
82
|
+
subject.instance_variable_set(:@result, result)
|
83
|
+
subject.send(:passing_spec)
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "#pending_spec" do
|
89
|
+
|
90
|
+
let(:json) { {"suite" => "_suite_", "label" => "_label_"} }
|
91
|
+
|
92
|
+
it "logs the information" do
|
93
|
+
result = Teabag::Result.build_from_json(json)
|
94
|
+
subject.should_receive(:log).with("ok 42 - [pending] _suite_ _label_")
|
95
|
+
subject.instance_variable_set(:@total, 42)
|
96
|
+
subject.instance_variable_set(:@result, result)
|
97
|
+
subject.send(:pending_spec)
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
describe "#failing_spec" do
|
103
|
+
|
104
|
+
let(:json) { {"suite" => "_suite_", "label" => "_label_", "message" => "_message_"} }
|
105
|
+
|
106
|
+
it "logs the information" do
|
107
|
+
result = Teabag::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)
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
|
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
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
require "rack/test"
|
3
5
|
|
@@ -64,13 +66,14 @@ describe Teabag::Instrumentation do
|
|
64
66
|
|
65
67
|
describe ".add_to" do
|
66
68
|
|
67
|
-
let(:asset) { mock(source:
|
69
|
+
let(:asset) { mock(source: source, pathname: 'path/to/instrument.js') }
|
70
|
+
let(:source) { "function add(a, b) { return a + b } // ☃ " }
|
68
71
|
|
69
72
|
before do
|
70
73
|
Teabag::Instrumentation.stub(:add?).and_return(true)
|
71
74
|
|
72
75
|
File.stub(:write)
|
73
|
-
subject.any_instance.stub(:instrument).and_return("
|
76
|
+
subject.any_instance.stub(:instrument).and_return(source + " // instrumented")
|
74
77
|
|
75
78
|
path = nil
|
76
79
|
Dir.mktmpdir { |p| path = p }
|
@@ -79,7 +82,7 @@ describe Teabag::Instrumentation do
|
|
79
82
|
end
|
80
83
|
|
81
84
|
it "writes the file to a tmp path" do
|
82
|
-
File.should_receive(:write).with(@output, "function add(a, b) { return a + b }")
|
85
|
+
File.should_receive(:write).with(@output, "function add(a, b) { return a + b } // ☃ ")
|
83
86
|
subject.add_to(response, env)
|
84
87
|
end
|
85
88
|
|
@@ -90,7 +93,7 @@ describe Teabag::Instrumentation do
|
|
90
93
|
|
91
94
|
it "replaces the response array with the appropriate information" do
|
92
95
|
response = [666, {"Content-Type" => "application/javascript"}, asset]
|
93
|
-
expected = [666, {"Content-Type" => "application/javascript", "Content-Length" => "
|
96
|
+
expected = [666, {"Content-Type" => "application/javascript", "Content-Length" => "59"}, asset]
|
94
97
|
|
95
98
|
subject.add_to(response, env)
|
96
99
|
expect(response).to eq(expected)
|