2010-11-25 14 views

Respuesta

0

no he probado todavía, pero hay una sección en la que le dice chapter 3 of the RailsTutorial algunos "hacks" para configurar spork. El tutorial actualmente dice:

... a partir de este escrito Spork no soporta oficialmente Rails 3

El capítulo continúa a decir cómo configurarlo mediante el autotest. Una cosa a saber es que usted necesitará

--drb

en su archivo .rspec.

13

ARTÍCULO 1mikbe has you covered! Me gustaría volver a expresarlo aquí, pero la publicación hace un gran trabajo.

Si usted está en OSX, también hay instrucciones para utilizar Growl para las notificaciones de la bandeja.

artículo 2Ruby Inside also has a walkthrough de carriles 3 y RSpec 2.

+1

¡Estupendo! ¡Gracias por el gran artículo! Funciona perfectamente para mí. – Shuo

4

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 .

Cuestiones relacionadas