]> git.openstreetmap.org Git - rails.git/blobdiff - vendor/gems/rspec-1.1.2/examples/pure/custom_formatter.rb
added RSpec and RSpec on Rails
[rails.git] / vendor / gems / rspec-1.1.2 / examples / pure / custom_formatter.rb
diff --git a/vendor/gems/rspec-1.1.2/examples/pure/custom_formatter.rb b/vendor/gems/rspec-1.1.2/examples/pure/custom_formatter.rb
new file mode 100644 (file)
index 0000000..c449fdc
--- /dev/null
@@ -0,0 +1,12 @@
+require File.dirname(__FILE__) + '/spec_helper'
+require 'spec/runner/formatter/progress_bar_formatter'
+
+# Example of a formatter with custom bactrace printing. Run me with:
+# ruby bin/spec failing_examples -r examples/custom_formatter.rb -f CustomFormatter
+class CustomFormatter < Spec::Runner::Formatter::ProgressBarFormatter
+  def backtrace_line(line)
+    line.gsub(/([^:]*\.rb):(\d*)/) do
+      "<a href=\"file://#{File.expand_path($1)}\">#{$1}:#{$2}</a> "
+    end
+  end
+end