Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding an html formatter for taglob, use with caution, it opens Spec:…

…:Runner::Formatter::HtmlFormatter
  • Loading branch information...
commit 325001ad7ae6ccef53dac23730393472658b15da 1 parent a3b616a
@scudco authored
Showing with 25 additions and 0 deletions.
  1. +1 −0  Manifest.txt
  2. +24 −0 lib/taglob/spec/tag_html_formatter.rb
View
1  Manifest.txt
@@ -12,6 +12,7 @@ lib/taglob/rake.rb
lib/taglob/rake/check_tags_task.rb
lib/taglob/rake/tasks.rb
lib/taglob/rake/test_tags_task.rb
+lib/taglob/spec/tag_html_formatter.rb
spec/check_tags_task_spec.rb
spec/dir_tagor_spec.rb
spec/missing_tags.txt
View
24 lib/taglob/spec/tag_html_formatter.rb
@@ -0,0 +1,24 @@
+# To display tag information while running the specs
+# USAGE : Set the tags first if using in command line
+# $ export tags=foo then run spec with following options
+#["--require rubygems,taglob/spec/tag_html_formatter --format TagHtmlFormatter:#{file_name}"]
+# Example:
+# $ spec --require rubygems,taglob/spec/tag_html_formatter --format TagHtmlFormatter:#{file_name}.html
+
+require 'spec/runner/formatter/html_formatter'
+
+class Spec::Runner::Formatter::HtmlFormatter
+ alias :original_report_header :report_header
+ alias :original_global_styles :global_styles
+ def report_header
+ if ENV['tags'].nil?
+ original_report_header
+ else
+ original_report_header + "<div id='tag-header'><h3>These specs contain the following tags: #{ENV['tags']}</h3></div>"
+ end
+ end
+
+ def global_styles
+ original_global_styles + ".rspec-report h3 {margin: 0px 10px 0px 10px; padding: 10px;font: normal 11px ,'Lucida Grande', Helvetica, sans-serif;font-size: 1.2em;}"
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.