]>
git.r.bdr.sh - rbdr/dotfiles/blob - vim/plugin/vim-rspec.rb
4d7f4c3c2dc1c8db687e54d34dc834607f189f77
4 doc
= Hpricot(STDIN.read
)
6 classes
= {"spec passed"=>"+","spec failed
"=>"-","spec not_implemented
"=>"#"}
8 puts
"* #{h1.inner_html}"
10 stats
= (doc
/"script").select {|script| script.innerHTML =~ /duration
|totals
/ }.map
{|script
| script
.inner_html
.scan(/".*"/).first
.gsub(/<\/?strong
>/,"") }
12 puts
"* #{stat.gsub(/\"/,'')}"
14 puts
"* Parsed with Hpricot (http://wiki.github.com/why/hpricot)"
17 (doc
/"div[@class='example_group']").each
do |example
|
18 puts
"[#{(example/"dl/dt").inner_html}]"
19 (example
/"dd").each
do |dd
|
20 txt
= (dd
/"span:first").inner_html
21 puts
"#{classes[dd[:class]]} #{txt}"
22 next if dd
[:class]!
="spec failed"
23 failure
= (dd
/"div[@class='failure']")
24 msg
= (failure
/"div[@class='message']/pre
").inner_html
25 back = (failure/"div
[@class='backtrace']/pre
").inner_html
26 ruby = (failure/"pre
[@class='ruby']/code
").inner_html.scan(/(<span class="linenum
">)(\d+)(<\
/span
>)([^
<]+
)/).map
{|elem
| " "+elem
[1]+
": "+elem
[3].chomp+
"\n"}.join