Skip to content

Commit

Permalink
output the description, not the object
Browse files Browse the repository at this point in the history
dchelimsky committed Jul 14, 2010
1 parent 225c9e2 commit 981bde0
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/rspec/core/formatters/base_text_formatter.rb
Original file line number Diff line number Diff line change
@@ -14,10 +14,10 @@ def dump_failures
exception = failed_example.execution_result[:exception_encountered]
padding = ' '
if exception.is_a?(RSpec::Core::PendingExampleFixedError)
output.puts "#{index.next}) #{failed_example} FIXED"
output.puts "#{index.next}) #{failed_example.full_description} FIXED"
output.puts "#{padding}Expected pending '#{failed_example.metadata[:execution_result][:pending_message]}' to fail. No Error was raised."
else
output.puts "#{index.next}) #{failed_example}"
output.puts "#{index.next}) #{failed_example.full_description}"
output.puts "#{padding}Failure/Error: #{read_failed_line(exception, failed_example).strip}"
exception.message.split("\n").each do |line|
output.puts "#{padding}#{red(line)}"
5 changes: 3 additions & 2 deletions spec/rspec/core/formatters/base_text_formatter_spec.rb
Original file line number Diff line number Diff line change
@@ -29,13 +29,14 @@ module RSpec::Core::Formatters
describe "#dump_failures" do
it "preserves formatting" do
output = StringIO.new
group = RSpec::Core::ExampleGroup.describe
example = group.example { "this".should eq("that") }
group = RSpec::Core::ExampleGroup.describe("group name")
example = group.example("example name") { "this".should eq("that") }
formatter = RSpec::Core::Formatters::BaseTextFormatter.new(output)
group.run_all(formatter)

RSpec.configuration.stub(:color_enabled?) { false }
formatter.dump_failures
output.string.should =~ /group name example name/m
output.string.should =~ /(\s+)expected \"that\"\n\1 got \"this\"/m
end
end

0 comments on commit 981bde0

Please sign in to comment.