diff --git a/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html b/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html index d7a646eed4..d9696d3f49 100644 --- a/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +++ b/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html @@ -184,7 +184,7 @@

RSpec Code Examples

pending spec with no implementation
- +
is pending (PENDING: Not Yet Implemented)
@@ -198,7 +198,7 @@

RSpec Code Examples

with content that would fail
- +
is pending (PENDING: No reason given)
@@ -207,22 +207,22 @@

RSpec Code Examples

with content that would pass
- +
fails
RSpec::Core::PendingExampleFixedError
- +
11          rescue Exception => e
 12          end
 13          raise RSpec::Core::PendingExampleFixedError.new if result
@@ -235,7 +235,7 @@ 

RSpec Code Examples

passing spec
- +
passes
@@ -243,7 +243,7 @@

RSpec Code Examples

failing spec
- +
fails
@@ -253,17 +253,17 @@

RSpec Code Examples

(compared using ==)
- +
27        end
 28
 29        raise(RSpec::Expectations::ExpectationNotMetError.new(message))
@@ -272,8 +272,43 @@ 

RSpec Code Examples

+
+
+
a failing spec with odd backtraces
+ + +
+ fails with a backtrace that has no file + +
+ +
+ fails with a backtrace containing an erb file +
+
Exception
+
/foo.html.erb:1 :in `
': foo (RuntimeError)
+
-1# Couldn't get snippet for /foo.html.erb
+
+
+
+
- + diff --git a/spec/rspec/core/formatters/text_mate_formatter_spec.rb b/spec/rspec/core/formatters/text_mate_formatter_spec.rb index 6f23089ff5..2d43770a05 100644 --- a/spec/rspec/core/formatters/text_mate_formatter_spec.rb +++ b/spec/rspec/core/formatters/text_mate_formatter_spec.rb @@ -23,6 +23,7 @@ module Formatters command_line = RSpec::Core::CommandLine.new(options) command_line.run(err, out) out.string.gsub /\d+\.\d+ seconds/, 'x seconds' + end let(:expected_html) do @@ -64,6 +65,19 @@ module Formatters end end end + + it "has a backtrace line from the raw erb evaluation" do + Dir.chdir(root) do + actual_doc = Nokogiri::HTML(generated_html) + + actual_doc.inner_html.should include('(erb):1:in') + end + end + + it "has a backtrace line from a erb source file we forced to appear" do + generated_html.should include('open?url=file:///foo.html.erb') + end + end end end diff --git a/spec/rspec/core/resources/formatter_specs.rb b/spec/rspec/core/resources/formatter_specs.rb index 20152b95f0..f4902d7d54 100644 --- a/spec/rspec/core/resources/formatter_specs.rb +++ b/spec/rspec/core/resources/formatter_specs.rb @@ -1,6 +1,5 @@ # Deliberately named _specs.rb to avoid being loaded except when specified - describe "pending spec with no implementation" do it "is pending" end @@ -34,3 +33,22 @@ 1.should eq(2) end end + +describe "a failing spec with odd backtraces" do + it "fails with a backtrace that has no file" do + require 'erb' + + ERB.new("<%= raise 'foo' %>").result + end + + it "fails with a backtrace containing an erb file" do + e = Exception.new + + def e.backtrace + ["/foo.html.erb:1:in `
': foo (RuntimeError)", + " from /lib/ruby/1.9.1/erb.rb:753:in `eval'"] + end + + raise e + end +end