lib/assert/view/terminal.rb in assert-0.2.1 vs lib/assert/view/terminal.rb in assert-0.3.0

- old
+ new

@@ -43,13 +43,19 @@ tplur = (tcount = count(:tests)) == 1 ? "test": "tests" "\nLoaded suite (#{tcount} #{tplur})" end def detailed_results - details = self.suite.ordered_results.reverse.collect do |result| - result_io_msg(result.to_s, result.to_sym) if show_result_details?(result) - end.compact + details = self.suite.ordered_tests.reverse.collect do |test| + test.results.collect do |result| + if show_result_details?(result) + [ result_io_msg(result.to_s, result.to_sym), + output_io_msg(test.output.to_s) + ].join("\n") + end + end + end.flatten.compact "\n\n" + details.join("\n\n") if !details.empty? end def results_stmt rplur = (rcount = count(:results)) == 1 ? "result" : "results" @@ -89,9 +95,18 @@ def result_io_msg(msg, result_sym) term_styles = if self.options.styled self.options.send("#{result_sym}_styles") end io_msg(msg, :term_styles => term_styles) + end + + def output_io_msg(output) + if output && !output.empty? + [ "--- stdout ---", + io_msg(output), + "--------------" + ].collect{|i| i.strip}.join("\n") + end end def io_msg(msg, opts={}) val = super if !(style = term_style(*opts[:term_styles])).empty?