yard-spec-plugin
yard-spec-plugin copied to clipboard
method_details/html/spec.erb is faulty due to .times not having a block.
The 'templates_custom/default/method_details/html/specs.erb' spec causes an exception as .times expects a block. The line:
<%= spec[:source].split("\n").size.times.to_a.map {|i| spec[:line] + i }.join("\n") %>
should read:
<%= (0..(spec[:source].split("\n").size)).map { |i| _erbout << spec[:line] + i } %>
or alternatively:
<%= spec[:source].count("\n").times { |i| _erbout << spec[:line] + i } %>
Though count may not work if the last line does not end with "\n". The "_erbout" is ugly so a utility function like the capture method in rails could be used.
What version is this? 1.8.6? #times should return an enumerator from 1.8.7 onwards.
Indeed. This is on version 1.8.6. Sorry forgot to mention. A lot of people are still on this version.