Forked from thechrisoshow/no_shoulds_punk_formatter.rb
Created
February 24, 2010 15:12
-
-
Save capitalist/313503 to your computer and use it in GitHub Desktop.
Revisions
-
thechrisoshow created this gist
Feb 24, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ require 'spec/runner/formatter/progress_bar_formatter' # Put this in spec/support and run with: # spec spec --require spec/support/no_shoulds_punk_formatter.rb --format NoShouldsPunkFormatter class NoShouldsPunkFormatter < Spec::Runner::Formatter::ProgressBarFormatter def initialize(options, output) super @examples_with_should = [] end def example_group_started(example_group_proxy) @example_group = example_group_proxy end def example_started(example) if example.description && example.description.starts_with?("should") @examples_with_should << ["#{@example_group.description} #{example.description}", example.location] end end def dump_summary(duration, example_count, failure_count, pending_count) super print_list_of_examples_with_should if @examples_with_should.any? end private def print_list_of_examples_with_should @output.puts @output.puts "You think you got off easy punk? Well what about:" @examples_with_should.each do |example| @output.puts "\n#{example[0]}" @output.puts "#{example[1]}\n" end @output.puts @output.puts "You big pansy." @output.flush end end