Skip to content

Commit

Permalink
Restore a public API I unintentionally broke in 39857f3.
Browse files Browse the repository at this point in the history
@DouweM rightly pointed out that I broke this API.

39857f3#commitcomment-2236278
  • Loading branch information
myronmarston committed Dec 1, 2012
1 parent c765c3b commit f06254c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions lib/rspec/core/formatters/base_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ def close
restore_sync_output
end

# @api public
#
# Formats the given backtrace based on configuration and
# the metadata of the given example.
def format_backtrace(backtrace, example)
super(backtrace, example.metadata)
end

protected

def configuration
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/core/formatters/base_text_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def format_caller(caller_info)
end

def dump_backtrace(example)
format_backtrace(example.execution_result[:exception].backtrace, example.metadata).each do |backtrace_info|
format_backtrace(example.execution_result[:exception].backtrace, example).each do |backtrace_info|
output.puts cyan("#{long_padding}# #{backtrace_info}")
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/core/formatters/html_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def example_failed(example)
exception_details = if exception
{
:message => exception.message,
:backtrace => format_backtrace(exception.backtrace, example.metadata).join("\n")
:backtrace => format_backtrace(exception.backtrace, example).join("\n")
}
else
false
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/core/formatters/base_formatter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
end

it "removes lines from rspec and lines that come before the invocation of the at_exit autorun hook" do
formatter.format_backtrace(backtrace).should eq(["./my_spec.rb:5"])
formatter.format_backtrace(backtrace, stub.as_null_object).should eq(["./my_spec.rb:5"])
end
end

Expand Down

0 comments on commit f06254c

Please sign in to comment.