Skip to content

Commit f5c74c2

Browse files
committed
[test] add test for exception capture content
1 parent 1db9bb2 commit f5c74c2

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/spec/ruby/rack/capture_spec.rb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,26 @@
1313
before :each do
1414
JRuby::Rack.context = nil
1515
$servlet_context = @servlet_context
16-
allow(@servlet_context).to receive(:init_parameter_names).and_return []
16+
allow(@servlet_context).to receive(:config).and_return Java::OrgJrubyRackEmbed::Config.new
1717
end
1818

1919
it "captures environment information" do
2020
expect(@servlet_context).to receive(:log)
21-
error = StandardError.new
21+
error = StandardError.new "simulated rack start-up failed"
2222
error.capture
2323
error.store
2424
expect(error.output).to be_a StringIO
25+
expect(error.output.string).to include "An exception happened during JRuby-Rack startup"
26+
expect(error.output.string).to include "simulated rack start-up failed"
27+
expect(error.output.string).to include "--- System"
28+
expect(error.output.string).to include "jruby #{JRUBY_VERSION}"
29+
expect(error.output.string).to include "--- Context Init Parameters:"
30+
expect(error.output.string).to include "--- RubyGems"
31+
expect(error.output.string).to include "Gem.path:"
32+
expect(error.output.string).to include "--- Bundler"
33+
expect(error.output.string).to include "Gemfile:"
34+
expect(error.output.string).to include "--- JRuby-Rack Config"
35+
expect(error.output.string).to include "logger_class_name"
2536
end
2637

2738
it "captures exception backtrace" do
@@ -34,4 +45,5 @@
3445
end
3546
end
3647

48+
3749
end

0 commit comments

Comments
 (0)