Skip to content

Instantly share code, notes, and snippets.

@textarcana
Created August 18, 2009 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save textarcana/169922 to your computer and use it in GitHub Desktop.
Save textarcana/169922 to your computer and use it in GitHub Desktop.
.autotest examples
# Override autotest default magic deciding which test to run when
# a file is changed
require 'snarl'
require 'autosnarl'
require 'autotest/timestamp'
Autotest.add_hook :initialize do |at|
at.clear_mappings
at.add_mapping(%r%^.*\.(js|xml|xsl|html)$%) do |f, _|
at.files_matching %r%^test/test_wwww_response.rb$%
end
end
require 'autotest/timestamp'
# = IMPORTANT
#
# Run autospec, not autotest. Because I am using RSpec here, not
# Test::Unit.
require 'helpers/platform_helper'
platform = PlatformHelper.new
if platform.win32?
require 'snarl'
require 'autosnarl'
elsif platform.mac?
require 'vendor/oddlyzen/autotest_growl'
end
Autotest.add_hook :initialize do |at|
files_to_exclude = %w{.hg .git .svn features stories tmtags Rakefile Capfile README spec/spec.opts spec/rcov.opts vendor/gems autotest svn-commit .DS_Store global_flymake.css}
files_to_exclude.each do |exception|
at.add_exception(exception)
end
at.clear_mappings
at.add_mapping(%r{^.*\.css$}) do |f, _|
at.files_matching(%r{^spec/for_css/.*_spec.rb$})
end
at.add_mapping(%r{^.*\.js$}) do |f, _|
at.files_matching(%r{^spec/for_js/.*_spec.rb$})
end
at.add_mapping(%r{^.*\.html$}) do |f, _|
at.files_matching(%r{^spec/for_html/.*_spec.rb$})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment