Sha256: 5d765af80b6b9a494873fdfaee9a67cba4f1b137a56ea4d2eceefaf7b1fd3eaa

Contents?: true

Size: 1.53 KB

Versions: 22

Compression:

Stored size: 1.53 KB

Contents

require 'autotest/restart'
require 'autotest/bundler'

Autotest.add_hook :initialize do |at|
  at.testlib = 'test/unit test/autocolor'

  # Remove the old test unit mappings
  at.clear_mappings

  # Don't track other dirs, this just burns cpu.
  (File.read('.gitignore').split("\n") + Dir['test/fixtures/**/*']).each do |ignore|
    next if ignore.nil? or ignore.empty?
    at.add_exception ignore
  end

  # Test::Unit is normally test_, so autotest doesn't have this mapping. Tests
  # want to match themselves, that is, if there's no changes, run them all.
  at.add_mapping(%r%^test/.*_test\.rb$%) { |f, _| f }

  # Allow for matches of lib files to test files in a flat way
  at.add_mapping(%r%^lib/(.*)\.rb$%) do |f, md|
    at.files_matching( %r%^test/#{md[1]}_test\.rb$%)
  end

  # Make sure that we run all tests if the helper changes:
  at.add_mapping(%r%^test/helper\.rb$%) do |f, _|
    at.files_matching %r%.*_test\.rb%
  end

  # If bundle did something, run all tests again
  at.add_mapping(%r%^Gemfile\.lock$%) do |f, _|
    at.files_matching %r%.*_test\.rb%
  end

  # If update support, run all tests
  at.add_mapping(%r%^test/support/.*\.rb$%) do |f, _|
    at.files_matching %r%.*_test\.rb%
  end

  def at.path_to_classname(path)
    file = File.basename(path, '.rb')

    file.gsub!('test_', '')
    file.gsub!('_test', '')
    file.capitalize + 'Test'
  end

end

# If the Gemfile gets updated, run bundle install
Autotest.add_hook :updated do |at, *args|
  if args.flatten.grep(%r%^Gemfile$|^.*\.gemspec$%).any?
    system 'bundle'
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
active_assets-1.1.3 .autotest
active_assets-1.1.2 .autotest
active_assets-1.1.1 .autotest
active_assets-1.0.3 .autotest
active_assets-1.1.0 .autotest
active_assets-0.3.1 .autotest
active_assets-1.0.2 .autotest
active_assets-1.0.1 .autotest
active_assets-1.0.0 .autotest
active_assets-0.3.0 .autotest
active_assets-1.0.0.rc1 .autotest
active_assets-0.2.8 .autotest
active_assets-0.2.7 .autotest
active_assets-0.2.6 .autotest
active_assets-0.2.5 .autotest
active_assets-0.2.4 .autotest
active_assets-0.2.3 .autotest
active_assets-0.2.2 .autotest
active_assets-0.2.1 .autotest
active_assets-0.2.0 .autotest