stephencelis / ghi

GitHub Issues on the command line. Use your $EDITOR, not your browser.

This URL has Read+Write access

ghi / .autotest
100644 26 lines (23 sloc) 0.798 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Force `autospec` to work.
 
Autotest::Rspec.send(:define_method, :make_test_cmd) do |files_to_test|
  return String.new if files_to_test.empty?
  files = files_to_test.keys.flatten.join " "
  "#{ruby} -S #{spec_command} #{add_options_if_present} #{files}"
end
 
class Autotest::Rspec
  def spec_command(separator=File::ALT_SEPARATOR)
    unless defined? @spec_command
      @spec_command = spec_commands.find { |cmd| File.exists? cmd }
      raise RspecCommandError,
        "No spec command could be found!" if @spec_command.nil?
      @spec_command.gsub! File::SEPARATOR, separator unless separator.nil?
    end
    @spec_command
  end
 
  def spec_commands
    [
      File.expand_path(File.dirname(__FILE__) + "/../../bin/spec"),
      File.join(Config::CONFIG["bindir"], "spec")
    ]
  end
end