2010-09-07 15 views
5

Estoy tratando de actualizar mi aplicación de rails a Rails3.NameError: constante no inicializada Test :: Unit :: AssertionFailedError al actualizar a rails3

Cuando ejecuto pruebas funcionales, recibo muchos errores NameError: uninitialized constant Test::Unit::AssertionFailedError. Pero las pruebas unitarias y el sitio web en sí parecen funcionar bien.

traza se ve así:

NameError: uninitialized constant Test::Unit::AssertionFailedError 
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing_from_s3_library' 
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/bundler/gems/shoulda-02520e4/lib/shoulda/action_controller/matchers/redirect_to_matcher.rb:52:in `rescue in redirects_to_url?' 
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/bundler/gems/shoulda-02520e4/lib/shoulda/action_controller/matchers/redirect_to_matcher.rb:48:in `redirects_to_url?' 
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/bundler/gems/shoulda-02520e4/lib/shoulda/action_controller/matchers/redirect_to_matcher.rb:35:in `matches?' 
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/bundler/gems/shoulda-02520e4/lib/shoulda/assertions.rb:53:in `assert_accepts' 
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/bundler/gems/shoulda-02520e4/lib/shoulda/context.rb:324:in `block in should' 
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/bundler/gems/shoulda-02520e4/lib/shoulda/context.rb:382:in `call' 
/Users/mantas/.rvm/gems/ruby-1.9.2-p0/bundler/gems/shoulda-02520e4/lib/shoulda/context.rb:382:in `block in create_test_from_should_hash' 

Tanto Shoulda y Amazon S3 gemas son las versiones más recientes.

¿Alguna idea de lo que estoy haciendo mal?

Respuesta

6

Esto se ha notificado http://github.com/thoughtbot/shoulda/issues/issue/117.

El trabajo alrededor (que por lo menos hace pasar este error de distancia, no estoy seguro si realidad obras derecha):

unless defined?(Test::Unit::AssertionFailedError) 
    class Test::Unit::AssertionFailedError < ActiveSupport::TestCase::Assertion 
    end 
end 
+0

Lamentablemente - Me olvidé de metion, puse ese fragmento en test/test_helper.rb –

6
solución de

Ash Berlín hará la excepción desaparece, sino que hará cualquier coincidente que try y catchTest::Unit::AssertionFailedError falle. Si AssertionFailedError es ActiveSupport::TestCase::Assertion, y lanza un ActiveSupport::TestCase::Assertion, no lo detectará como Test::Unit::AssertionFailedError. Él tiene su relación de herencia al revés. En su lugar, ponga esto en su test_helper.rb:

unless defined?(Test::Unit::AssertionFailedError) 
    Test::Unit::AssertionFailedError = ActiveSupport::TestCase::Assertion 
end 
Cuestiones relacionadas