= autowatchr Provides some autotest-like behavior for watchr (http://github.com/mynyml/watchr). == Installation gem install autowatchr --source http://gemcutter.org == Current features * Auto-watches test and lib files using the autotest layout * Optionally run only failing-tests * Optionally run entire suite after all tests pass * Traps INT signal (Control-C) and re-runs all tests. == Todo * Cucumber support * Expose algorithm to map test classes to test files == Example use Create a .watchr file for your project and simply declare an Autowatchr block within it: # test/test.watchr require 'autowatchr' Autowatchr.new(self) do |config| config.ruby = 'jruby' config.lib_dir = 'leet_lib' config.test_dir = 'leet_test' end Your tests can then be run with: $ watchr test/test.watchr === Configuration options * command * An ERB template for the command * Default: "<%= ruby %> -I<%= include %> <% list_of_requires.each { |lib| %>-r<%= lib %> <% } %><%= predicate %>" * ruby * The ruby executable to use * Default: "ruby" * include * Paths to include (with -I) * Default: ".:#{self.lib_dir}:#{self.test_dir}" * require * Libraries to include (with -r) * Can either be a string or an array (Ex: config.require = %w{rubygems active_support}) * Default: nil * lib_dir * The lib path, where your library lives * Default: "lib" * test_dir * The test path, where your tests live * Default: "test" * lib_re * The regexp to use for discovering library files * Default: '^%s.*/.*\.rb$' % self.lib_dir * test_re * The regexp to use for discovering test files * Default: '^%s.*/test_.*\.rb$' % self.test_dir * test_file * The filename pattern for correlating test files with lib files. The %s will be substituted for the basename of the lib file. * Default: 'test_%s.rb' * failing_only * Run only failing tests the next time a test file is run * Default: true * run_suite * Run entire test suite after failing tests pass * Default: true All of the config options are optional. You can also pass in a hash instead of a block. Also see: test.watchr[http://github.com/viking/autowatchr/blob/master/test.watchr]. == Using with RSpec Autowatchr can easily be configured to work with the standard RSpec file hierarchy: # spec/spec.watchr require 'autowatchr' Autowatchr.new(self) do |config| config.test_dir = 'spec' config.test_re = "^#{config.test_dir}/(.*)_spec\.rb$" config.test_file = '%s_spec.rb' end Be sure you have spec_helper.rb required in every spec file, or else put it in your .watchr file. == Prettier Results Autowatchr is compatible with the Watchr redgreen gem. Install 'mynyml-redgreen' and simply require it in your .watchr file. == Copyright Copyright (c) 2009 Jeremy Stephens. See LICENSE for details. Many snippets were taken from ZenTest[http://github.com/seattlerb/ZenTest]. == Contributors * Stephen Eley (SFEley) * Adam Grant (harmon)