Skip to content
Browse files

preserve failure message formatting in base text formatter

  • Loading branch information...
1 parent 121f7b2 commit 6ef074950b6173c9ff2bda21b1c680b4c4a26c3b @dchelimsky dchelimsky committed May 17, 2010
View
2 lib/rspec/core/formatters/base_text_formatter.rb
@@ -18,7 +18,7 @@ def dump_failures
output.puts "#{index.next}) #{failed_example}"
output.puts "#{padding}Failure/Error: #{read_failed_line(exception, failed_example).strip}"
exception.message.split("\n").each do |line|
- output.puts "#{padding}#{colorise(line, exception).strip}"
+ output.puts "#{padding}#{colorise(line, exception)}"
end
end
View
2 rspec-core.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.authors = ["Chad Humphries", "David Chelimsky"]
- s.date = %q{2010-05-16}
+ s.date = %q{2010-05-17}
s.description = %q{RSpec runner and example group classes}
s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
s.executables = ["rspec", "spec"]
View
21 spec/rspec/core/formatters/base_text_formatter_spec.rb
@@ -0,0 +1,21 @@
+require "spec_helper"
+
+module RSpec::Core::Formatters
+
+ describe BaseTextFormatter do
+ describe "#dump_failures" do
+ it "preserves formatting" do
+ output = StringIO.new
+ group = RSpec::Core::ExampleGroup.describe
+ example = group.example { "this".should eq("that") }
+ formatter = BaseTextFormatter.new
+ group.run_all(formatter)
+
+ RSpec.configuration.stub(:output) { output }
+ RSpec.configuration.stub(:color_enabled?) { false }
+ formatter.dump_failures
+ output.string.should =~ /(\s+)expected \"that\"\n\1 got \"this\"/m
+ end
+ end
+ end
+end

0 comments on commit 6ef0749

Please sign in to comment.
Something went wrong with that request. Please try again.