ruby-on-rails ruby ruby-on-rails-4.2

ruby on rails - método no definido ''caché'' para nil: NilClass después de actualizar a los rieles 4.2.5.1



ruby-on-rails ruby-on-rails-4.2 (1)

Este es un problema de rspec / rspec-rails.

Puede actualizar a rspec-rails-3.4.1 para solucionarlo. A menos que haya codificado la versión de rspec-rails en su Gemfile, ejecute:

bundle update rspec-rails rspec

debe solucionar el problema.

Al actualizar desde los rieles 4.2.5 a los 4.2.5.1 recientemente lanzados, me he encontrado con este error. Este error existe solo para las especificaciones con un before_filter que representa un estado no válido, como el render file: "public/422", status: :unauthorized . Me sale este error para ruby-2.2.2 y ruby-2.3.0

El error existe en el método de resolución action_view, lo que implica que el valor @cache es nil. Sin embargo, en el método de initialize se debe crear una instancia: @cache = Cache.new

Todavía estoy trabajando en una muestra reproducible, pero hasta ahora estoy perdido en cuanto a cómo @cache podría ser nulo.

Estas son las variables de configuración establecidas en mi entorno test.rb

config.cache_classes = true config.eager_load = false config.serve_static_files = true config.static_cache_control = ''public, max-age=3600'' config.consider_all_requests_local = true config.action_controller.perform_caching = false config.action_dispatch.show_exceptions = false config.action_controller.allow_forgery_protection = false config.action_mailer.default_url_options = { :host => ''127.0.0.1'', :port => 3000 } config.action_mailer.delivery_method = :test config.active_support.test_order = :random config.active_support.deprecation = :stderr

Traza de la pila:

1) UserController validates user Failure/Error: put :update, { id: user.id } NoMethodError: undefined method `cache'' for nil:NilClass # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/template/resolver.rb:151:in `cached'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/template/resolver.rb:121:in `find_all_anywhere'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/path_set.rb:68:in `block (2 levels) in _find_all'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/path_set.rb:66:in `each'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/path_set.rb:66:in `block in _find_all'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/path_set.rb:65:in `each'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/path_set.rb:65:in `_find_all'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/path_set.rb:50:in `find_file'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/lookup_context.rb:126:in `find_file'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/renderer/abstract_renderer.rb:18:in `find_file'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:32:in `block in determine_template'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/lookup_context.rb:147:in `with_fallbacks'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/renderer/abstract_renderer.rb:18:in `with_fallbacks'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:32:in `determine_template'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:8:in `render'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/renderer/renderer.rb:42:in `render_template'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/renderer/renderer.rb:23:in `render'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/rendering.rb:100:in `_render_template'' # ~/.rvm/gems/ruby-2.2.2/gems/actionpack-4.2.5.1/lib/action_controller/metal/streaming.rb:217:in `_render_template'' # ~/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5.1/lib/action_view/rendering.rb:83:in `render_to_body'' # ~/.rvm/gems/ruby-2.2.2/gems/actionpack-4.2.5.1/lib/action_controller/metal/rendering.rb:32:in `render_to_body'' # ~/.rvm/gems/ruby-2.2.2/gems/actionpack-4.2.5.1/lib/action_controller/metal/renderers.rb:37:in `render_to_body'' # ~/.rvm/gems/ruby-2.2.2/gems/actionpack-4.2.5.1/lib/abstract_controller/rendering.rb:25:in `render'' # ~/.rvm/gems/ruby-2.2.2/gems/actionpack-4.2.5.1/lib/action_controller/metal/rendering.rb:16:in `render'' # ~/.rvm/gems/ruby-2.2.2/gems/actionpack-4.2.5.1/lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'' # ~/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.5.1/lib/active_support/core_ext/benchmark.rb:12:in `block in ms'' # ~/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'' # ~/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.5.1/lib/active_support/core_ext/benchmark.rb:12:in `ms'' # ~/.rvm/gems/ruby-2.2.2/gems/actionpack-4.2.5.1/lib/action_controller/metal/instrumentation.rb:44:in `block in render'' # ~/.rvm/gems/ruby-2.2.2/gems/actionpack-4.2.5.1/lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'' # ~/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.5.1/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'' # ~/.rvm/gems/ruby-2.2.2/gems/actionpack-4.2.5.1/lib/action_controller/metal/instrumentation.rb:43:in `render''