Si utiliza Ruby 1.9 y desea utilizar spork y Autotest junto con Test :: Unidad (en realidad Minitest) intente esto:
Gemfile:
group :test do
# Newer version of test::unit:
gem 'minitest'
# spork preloads a rails instance which is forked every time the tests are
# run, removing test startup time.
gem 'spork'
# Run 'spork minitest' to start drb server (test server). Use 'testdrb' to
# run individual tests via spork.
gem 'spork-minitest'
# Run 'bundle exec autotest' to rerun relevant tests whenever a file/test is
# changed. '.autotest' makes sure the tests are run via test server (spork).
gem 'autotest-standalone'
# -pure gives us autotest without ZenTest gem.
gem 'autotest-rails-pure'
end
.autotest:
class Autotest
# run tests over drb server (spork)
def make_test_cmd files_to_test
if files_to_test.empty?
"" # no tests to run
else
"testdrb #{files_to_test.keys.join(' ')}"
end
end
end
(Nota: Las instrucciones dice bin/testdrb
, pero lo cambiaron a testdrb
para hacer que funcione para mí.)
en un terminal:
spork minitest --bootstrap
Editar test/test_helper.rb
y siga las instrucciones.
Después de la configuración anterior se realiza una vez, puede iniciar el servidor de prueba:
spork minitest
finalmente empezar autotest en otro terminal:
bundle exec autotest
y (con suerte) disfrutan autotesting muy rápido con Minitest .
¡Estupendo! ¡Gracias por el gran artículo! Funciona perfectamente para mí. – Shuo