Changeset cd1f3381c1ed
- Timestamp:
- 12/24/10 20:01:10 (17 months ago)
- Branch:
- vim-stuff
- Location:
- specky
- Files:
-
- 3 edited
-
doc/specky.txt (modified) (1 diff)
-
ruby/specky_formatter.rb (modified) (6 diffs)
-
syntax/specrun.vim (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
specky/doc/specky.txt
r19 r21 92 92 ways. 93 93 94 1) Set the *g:speckyRunSpecCmd*variable explicitly:95 96 let g:speckyRun RdocCmd = "rspec -r ~/.vim/ruby/specky_formatter.rb -f SpeckyFormatter" ~97 98 2) or, leave *g:speckyRunSpecCmd*at its default value, and instead use94 1) Set the 'g:speckyRunSpecCmd' variable explicitly: 95 96 let g:speckyRunSpecCmd = "rspec -r ~/.vim/ruby/specky_formatter.rb -f SpeckyFormatter" ~ 97 98 2) or, leave 'g:speckyRunSpecCmd' at its default value, and instead use 99 99 an '.rspec' settings file in the root directory of the the project 100 100 you're working in. I find this method much more flexible -- the -
specky/ruby/specky_formatter.rb
r19 r21 15 15 @failure_index = 0 16 16 @failures = [] 17 @txt = '' 18 @summary = '' 17 19 end 20 18 21 19 22 ######################################################################## … … 24 27 ### 25 28 def example_group_started( example_group ) 26 output.puts27 29 self.out '+', '-' * (example_group.description.length + 2), '+' 28 30 self.out '| ', example_group.description, ' |' … … 74 76 ### 75 77 def dump_failures 76 self.out "\n \n\n" unless @failures.empty?78 self.out "\n" unless @failures.empty? 77 79 78 80 @failures.each_with_index do |example, index| 79 81 desc = example.metadata[ :full_description ] 80 82 exception = example.execution_result[ :exception ] 83 file = line = nil 81 84 85 if exception.backtrace.first =~ /(.*):(\d+)/ 86 file, line = $1, $2.to_i 87 end 82 88 self.out "FAILURE - #%d)" % [ index + 1 ] 89 self.out "%s:%d" % [ file, line ] 83 90 84 91 if RSpec::Core::PendingExampleFixedError === exception … … 101 108 end 102 109 end 103 self.out "\n" 110 111 self.out exception_source( file, line ) if file && line 104 112 end 113 end 114 115 116 ### Emit the source of the exception, with context lines. 117 ### 118 def exception_source( file, line ) 119 context = '' 120 low, high = line - 3, line + 3 121 122 File.open( file ).each_with_index do |cline, i| 123 cline.chomp!.rstrip! 124 next unless i >= low && i <= high 125 context << " %s%4d: %s\n" % [ ( i == line ? '>>' : ' |' ), i, cline ] 126 end 127 128 return context 129 130 rescue 131 'Unable to parse exception context lines.' 105 132 end 106 133 … … 110 137 def dump_summary( duration, example_count, failure_count, pending_count ) 111 138 succeeded = example_count - failure_count - pending_count 112 self.out '+', '-' * 49, '+'113 self.out '|', ' ' * 18, '-- Summary --', ' ' * 18, '|'114 self.out '+----------+-----------+--------+---------+-------+'115 self.out '| Duration | Succeeded | Failed | Pending | Total |'116 self.out '+----------+-----------+--------+---------+-------+'139 @summary << "+%s+\n" % [ '-' * 49 ] 140 @summary << "|%s-- Summary --%s|\n" % [ ' ' * 18, ' ' * 18 ] 141 @summary << "+----------+-----------+--------+---------+-------+\n" 142 @summary << "| Duration | Succeeded | Failed | Pending | Total |\n" 143 @summary << "+----------+-----------+--------+---------+-------+\n" 117 144 118 self.out "| %7ss | %9s | %6s | %7s | %5s |" % [145 @summary << "| %7ss | %9s | %6s | %7s | %5s |\n" % [ 119 146 "%0.3f" % duration, succeeded, failure_count, 120 147 pending_count, example_count 121 148 ] 122 149 123 self.out '+----------+-----------+--------+---------+-------+' 150 @summary << "+----------+-----------+--------+---------+-------+\n\n" 151 end 152 153 154 ### End of run. Dump it all out! 155 ### 156 def close 157 output.puts @summary 158 output.puts @txt 124 159 end 125 160 … … 133 168 def out( *msg ) 134 169 msg = msg.join 135 output.puts "%s%s" % [ ' ' * @indent_level, msg ]170 @txt << "%s%s\n" % [ ' ' * @indent_level, msg ] 136 171 end 137 172 -
specky/syntax/specrun.vim
r19 r21 28 28 29 29 " Failure details 30 syntax region specFailedDetails start="^FAILURE - #\d\+)" end="^$" fold contains=specCallout 30 syntax region specFailedDetails start="^FAILURE - #\d\+)" end="^$" fold contains=specCallout,specErrorLine 31 syntax match specErrorLine /^ >>/ 32 31 33 32 34 " Boxes … … 52 54 highlight def link specBoxContent Constant 53 55 highlight def link specBoxLine LineNr 56 highlight def link specErrorLine ErrorMsg 54 57 55 58 let b:current_syntax = "specrun"
Note: See TracChangeset
for help on using the changeset viewer.
