Skip to content

Commit

Permalink
bug fix - better detection of "first line options"
Browse files Browse the repository at this point in the history
If you're story runner file has "#!/usr/bin/env ruby" at the top (like restful authentication does by default), it causes the story runner bundle to blow up when running tests.

This commit addresses the issue by checking for a color surrounded by text, and ignores any items that are malformed options if so (ie: # option:value,bogus)
  • Loading branch information
timcharper authored and bmabey committed Sep 15, 2008
1 parent 368d77e commit 0d8f0c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Support/lib/spec/mate/story/files/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ def is_runner_file?; false; end
def parse_options
return {} unless File.file?(full_file_path)
first_line = File.open(full_file_path) {|f| f.readline unless f.eof} || ''
return {} unless first_line.match(/\s*#\s*(.*)/)
return {} unless first_line.match(/\s*#\s*(.+:.+)/)
$1.split(',').inject({}) do |hash, pair|
k,v = pair.split(':')
hash[k.strip.to_sym] = v.strip
hash[k.strip.to_sym] = v.strip if k && v
hash
end
end
Expand Down

0 comments on commit 0d8f0c7

Please sign in to comment.