Rails:为什么RSpec在我重写的Devise控制器请求规格上崩溃? [英] Rails: Why does RSpec crash on my overridden Devise controller request spec?
问题描述
更新:哦,好的悲伤,这是一个坏的合并后的一个红色的鲱鱼。在某个地方,以下是从清理spec / spechelper.rb中消除的
目录[#{Rails.root } / app / ** / *。rb]。each {| f |加载f}
现在已经恢复,一切都正常工作。我怀疑它只是加载平面目录,而不是嵌套的目录,使它像命名空间问题一样。
(我不能回答我自己的问题,因为这是一个新帐号,我没有代表)
原始问题: / p>
我的大部分RSpec / Capybara测试工作正常,但是我有一个测试,只是试图访问一个路径,而我坚持调试我怀疑这是一个命名空间问题,但我不知道如何解决这个问题;任何帮助感激不尽。
整个测试是:
require'spec_helper'
描述'注册'做
上下文'调试阻塞问题'do
它'这个最小的测试应该通过'do
访问new_user_registration_path
end
end
end
错误消息是:
$ bin / rspec spec / requests / users / registrations_spec.rb
失败:
1)用户::调试阻塞问题时的注册此最小测试应通过
失败/错误:访问new_user_registration_path
LoadError:
预期的应用程序/ controllers / users / registrations_controller。 rb在'
$ b $中定义Users :: RegistrationsController
#./spec/requests/users/registrations_spec.rb:10:in'block(3 levels) b
所以错误是预期的users / registrations_controller.rb来定义用户::注册控制器,这不是很有帮助!
控制器是一个被重写的Devise控制器,它看起来像:
class Users :: RegistrationsController< Devise :: RegistrationsController
def create
super
#我的额外代码在这里
end
end
我的路由重定向设计一点:
devise_for:users, => {:registrations => 'users / registrations'} do
get'/ users / sign_out'=> 'devise / sessions#destroy'
end
我完全坚持试图找到预期的foo.rb定义Foo错误的根本原因;我无法深入了解真正导致我的问题。
您将在旁边进行什么调试?
大卫建议一个回溯可能有帮助;据我所见,我没有一个错误阻止加载,看起来像我(但我是一个轨道noob)像所有ActiveSupport块。这是感兴趣的:
1)用户::在调试阻塞问题时注册此最小测试应通过
失败/错误:访问new_user_registration_path
LoadError:
预期的app / controllers / users / registrations_controller.rb定义Users :: RegistrationsController
#.rvm / gems / ruby-1.9.3- p0@foo/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:490:在`load_missing_constant'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / activesupport- 3.1.0 / lib / active_support / dependencies.rb:181:在const_missing中的块中
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / activesupport-3.1.0 / lib / active_support / dependencies.rb:179:在each
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / activesupport-3.1.0 / lib / active_support / dependencies.rb:179:在`const_missing'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / activesupport-3.1.0 / lib / active_support / inflector / methods.rb:124:在`block in constantize'
#.rvm /gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:123:in`each'
#.rvm / gems / ruby-1.9 .3-p0 @ foo / gems / activesupport-3.1.0 / lib / active_support / inflector / methods.rb:123:在`constantize'
#.rvm / gems / ruby-1.9.3-p0 @ foo /gems/activesupport-3.1.0/lib/active_support/dependencies.rb:528:in`block in initialize'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / activesupport-3.1 .0 / lib / active_support / dependencies.rb:550:在`yield'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / activesupport-3.1.0 / lib / active_support / dependencies .rb:550:in'default'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / activesupport-3.1.0 / lib / active_support / dependencies.rb:550:in`[ ]'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / actionpack-3.1.0 / lib / action_dispatch / routing / route_set.rb:61:在`controller_reference'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / actionpack-3.1.0 / lib / action_dispatch / routing / route_set.rb:46:在`controller'
#.rvm / gems /红宝石1 .9.3-p0 @ foo / gems / actionpack-3.1.0 / lib / action_dispatch / routing / route_set.rb:25:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo /gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:41:in`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack-mount -0.8.3 / lib / rack / mount / route_set.rb:152:在`block in call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack-mount-0.8 .3 / lib / rack / mount / code_generation.rb:96:在`block in recognition'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack-mount-0.8.3 /lib/rack/mount/code_generation.rb:110:in`optimized_each'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack-mount-0.8.3 / lib / rack /mount/code_generation.rb:95:in`认识'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack-mount-0.8.3 / lib / rack / mount / route_set .rb:141:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / actionpack-3.1.0 / lib / action_dispatch / routing / route_set.rb:531:in `call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / sass-3.1.12 / lib / sass / plugin / rack.rb:54:在`call '
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / warden-1.1.0 / lib / warden / manager.rb:35:在`block in call'
# .rvm / gems / ruby-1.9.3-p0 @ foo / gems / warden-1.1.0 / lib / warden / manager.rb:34:在`catch'
#.rvm / gems / ruby-1.9 .3-p0 @ foo / gems / warden-1.1.0 / lib / warden / manager.rb:34:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems /actionpack-3.1.0/lib/action_dispatch/middleware/best_standards_support.rb:17:in`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack-1.3.5 /lib/rack/etag.rb:23:in`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack-1.3.5 / lib / rack / conditionalget.rb :25:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / actionpack-3.1.0 / lib / action_dispatch / middleware / head.rb:14: '
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / actionpack-3.1.0 / lib / action_dispatch / middleware / params_parser.rb:21:在`call'
# .rvm / gems / ruby-1.9.3-p0 @ foo / gems / actionpack-3.1.0 / lib / action_dispatch / middleware / flash.rb:243:在`call'
#.rvm / gems / ruby-1.9.3-p0@foo/gems/rack-1.3.5/lib/rack/session/abstract/id.rb:195:在`上下文'
#.rvm / gems / ruby-1.9。 3-p0@foo/gems/rack-1.3.5/lib/rack/session/abstract/id.rb:190:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / actionpack-3.1.0 / lib / action_dispatch / middleware / cookies.rb:326:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / activerecord- 3.1.0 / lib / active_record / query_cache.rb:62:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / activerecord-3.1.0 / lib / active_record / connection_adapters / abstract / connection_pool.rb:477:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / actionpack-3.1.0 / lib / action_dispatch / middleware / callbacks。 rb:29:在`block in call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / activesupport-3.1.0 / lib / active_support / callbacks.rb:392:in` _run_call_callbacks'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / activesupport-3.1.0 / lib / active_support / callbacks.rb:81:在`run_callbacks'
#。 rvm/gems/ruby-1.9.3-p0@foo/gems/actionpac k-3.1.0 / lib / action_dispatch / middleware / callbacks.rb:28:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack-1.3.5 / lib / rack / sendfile.rb:101:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / actionpack-3.1.0 / lib / action_dispatch / middleware / remote_ip。 rb:48:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / actionpack-3.1.0 / lib / action_dispatch / middleware / show_exceptions.rb:调用'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / railties-3.1.0 / lib / rails / rack / logger.rb:13:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack-1.3.5 / lib / rack / methodoverride.rb:24:在`call'
#.rvm / gems / ruby- 1.9.3-p0@foo/gems/rack-1.3.5/lib/rack/runtime.rb:17:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / activesupport-3.1.0 / lib / active_support / cache / strategy / local_cache.rb:72:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack- 1.3.5 / lib / rack / lock.rb:15:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / actionpack-3.1.0 / lib / action_dispatch /粗粉leware / static.rb:53:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / railties-3.1.0 / lib / rails / engine.rb:455:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack-1.3.5 / lib / rack / urlmap.rb:52:在`block in call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack-1.3.5 / lib / rack / urlmap.rb:46:在each
#.rvm / gems / ruby-1.9.3-p0@foo/gems/rack-1.3.5/lib/rack/urlmap.rb:46:在`call'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack-test-0.6.1 / lib / rack / mock_session.rb:30:在`request'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack- test-0.6.1 / lib / rack / test.rb:219:在'process_request'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rack-test-0.6.1 / lib / rack / test.rb:57:在`get'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / capybara-1.1.2 / lib / capybara / rack_test / browser。 rb:62:在'进程'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / capybara-1.1.2 / lib / capybara / rack_test / browser.rb:21:访问'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / capybara-1.1.2 / lib / capyba ra / rack_test / driver.rb:32:在`visit'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / capybara-1.1.2 / lib / capybara / session.rb: 157:在`visit'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / capybara-1.1.2 / lib / capybara / dsl.rb:161:在`visit'
$ b#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-中的$ b#./spec/requests/users/registrations_spec.rb:10:in`block(3级别) core-2.7.1 / lib / rspec / core / example.rb:51:在`instance_eval'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-core-2.7。 1 / lib / rspec / core / example.rb:51:在`block in run'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-core-2.7.1 / lib / rspec / core / example.rb:110:在`with_around_hooks'中
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-core-2.7.1 / lib / rspec / core / example.rb:48:在`run'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-core-2.7.1 / lib / rspec / core / example_group。 rb:306:在`run_examples'中的块
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-core-2.7.1 / lib / rspec / core / example_group.rb: 302:在地图上
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-core-2.7.1 / lib / rspec / core / example_group.rb:302:在`run_examples'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-core-2.7.1 / lib / rspec / core / example_group.rb:274:在`run'
#.rvm / gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:275:在`block in run'
#.rvm / gems / ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:275:在map
#.rvm / gems / ruby-1.9中。 3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:275:在`run'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-core-2.7.1 / lib / rspec / core / command_line.rb:24:在`block(2级)'运行'
#.rvm / gems / ruby-1.9.3- p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:24:在`map'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-core-2.7.1 / lib / rspec / core / command_line.rb:24:在`block in run'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec的核心-2.7.1 / lib目录/ RSpec的/核心/记者.rb:12:在`report'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-core-2.7.1 / lib / rspec / core / command_line.rb:21 :在`run'
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-core-2.7.1 / lib / rspec / core / runner.rb:80:在`run_in_process '
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-core-2.7.1 / lib / rspec / core / runner.rb:66:在rescue in run
#.rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-core-2.7.1 / lib / rspec / core / runner.rb:62:在`run'
# .rvm / gems / ruby-1.9.3-p0 @ foo / gems / rspec-core-2.7.1 / lib / rspec / core / runner.rb:10:在`block in autorun'
如果输入 bin / rspec --help
,您将看到可以添加到命令的选项和开关列表,包括 - backtrace
开关,它告诉RSpec向您显示完整的追溯。如果您运行 bin / rspec spec / requests / users / registrations_spec.rb --backtrace
,那么您应该准确地看到错误来自哪里。
HTH,
David
Update: Oh good grief, it was all a red herring following a bad merge. Somewhere along the line, the following for elided from a cleanup of spec/spechelper.rb
Dir["#{Rails.root}/app/**/*.rb"].each {|f| load f}
Now that this is restored, everything is working again. I suspect it was only load the flat dir, and not nested dirs, making it look like a namespace issue.
(I can't answer my own question as this is a new account, and I don't have the rep)
Original question:
Most of my RSpec/Capybara tests work fine, but I have one test that explodes on simply trying to visit a path, and I'm stuck on debugging. I suspect it's a Namespace issue but I don't know how to address that; any help gratefully received.
The entire test is:
require 'spec_helper'
describe 'Registrations' do
context 'when debugging the blocking issue' do
it 'this minimal test should pass' do
visit new_user_registration_path
end
end
end
The error message is:
$ bin/rspec spec/requests/users/registrations_spec.rb
Failures:
1) Users::Registrations when debugging the blocking issue this minimal test should pass Failure/Error: visit new_user_registration_path LoadError: Expected app/controllers/users/registrations_controller.rb to define Users::RegistrationsController # ./spec/requests/users/registrations_spec.rb:10:in `block (3 levels) in '
So the error is Expected users/registrations_controller.rb to define Users::RegistrationsController, that's not much help!
The controller is an overridden Devise controller, and it looks like:
class Users::RegistrationsController < Devise::RegistrationsController
def create
super
# My extra code here
end
end
My routes redirect devise a little:
devise_for :users, :controllers => { :registrations => 'users/registrations' } do
get '/users/sign_out' => 'devise/sessions#destroy'
end
I'm utterly stuck on trying to find a root cause for the 'Expected foo.rb to define Foo' error'; I can't get an insight into what's really causing my issue.
What would you do next to debug this?
David suggested a backtrace might help; as far as I can see, I don't have an error preventing loading, looks to me (but I'm a rails noob) like all ActiveSupport blocks. Here it is for interest:
1) Users::Registrations when debugging the blocking issue this minimal test should pass Failure/Error: visit new_user_registration_path LoadError: Expected app/controllers/users/registrations_controller.rb to define Users::RegistrationsController # .rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:490:in `load_missing_constant' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:181:in `block in const_missing' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:179:in `each' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:179:in `const_missing' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:124:in `block in constantize' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:123:in `each' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:123:in `constantize' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:528:in `block in initialize' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:550:in `yield' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:550:in `default' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:550:in `[]' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/routing/route_set.rb:61:in `controller_reference' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/routing/route_set.rb:46:in `controller' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/routing/route_set.rb:25:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:41:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:152:in `block in call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:96:in `block in recognize' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:110:in `optimized_each' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:95:in `recognize' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:141:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/routing/route_set.rb:531:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/sass-3.1.12/lib/sass/plugin/rack.rb:54:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/warden-1.1.0/lib/warden/manager.rb:35:in `block in call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/warden-1.1.0/lib/warden/manager.rb:34:in `catch' # .rvm/gems/ruby-1.9.3-p0@foo/gems/warden-1.1.0/lib/warden/manager.rb:34:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-1.3.5/lib/rack/etag.rb:23:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-1.3.5/lib/rack/conditionalget.rb:25:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/middleware/head.rb:14:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/middleware/params_parser.rb:21:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/middleware/flash.rb:243:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-1.3.5/lib/rack/session/abstract/id.rb:195:in `context' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-1.3.5/lib/rack/session/abstract/id.rb:190:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/middleware/cookies.rb:326:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activerecord-3.1.0/lib/active_record/query_cache.rb:62:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/callbacks.rb:392:in `_run_call_callbacks' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/callbacks.rb:81:in `run_callbacks' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/middleware/callbacks.rb:28:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-1.3.5/lib/rack/sendfile.rb:101:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/middleware/remote_ip.rb:48:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/middleware/show_exceptions.rb:47:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/railties-3.1.0/lib/rails/rack/logger.rb:13:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-1.3.5/lib/rack/methodoverride.rb:24:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-1.3.5/lib/rack/runtime.rb:17:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.0/lib/active_support/cache/strategy/local_cache.rb:72:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-1.3.5/lib/rack/lock.rb:15:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/actionpack-3.1.0/lib/action_dispatch/middleware/static.rb:53:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/railties-3.1.0/lib/rails/engine.rb:455:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-1.3.5/lib/rack/urlmap.rb:52:in `block in call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-1.3.5/lib/rack/urlmap.rb:46:in `each' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-1.3.5/lib/rack/urlmap.rb:46:in `call' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-test-0.6.1/lib/rack/mock_session.rb:30:in `request' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-test-0.6.1/lib/rack/test.rb:219:in `process_request' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rack-test-0.6.1/lib/rack/test.rb:57:in `get' # .rvm/gems/ruby-1.9.3-p0@foo/gems/capybara-1.1.2/lib/capybara/rack_test/browser.rb:62:in `process' # .rvm/gems/ruby-1.9.3-p0@foo/gems/capybara-1.1.2/lib/capybara/rack_test/browser.rb:21:in `visit' # .rvm/gems/ruby-1.9.3-p0@foo/gems/capybara-1.1.2/lib/capybara/rack_test/driver.rb:32:in `visit' # .rvm/gems/ruby-1.9.3-p0@foo/gems/capybara-1.1.2/lib/capybara/session.rb:157:in `visit' # .rvm/gems/ruby-1.9.3-p0@foo/gems/capybara-1.1.2/lib/capybara/dsl.rb:161:in `visit' # ./spec/requests/users/registrations_spec.rb:10:in `block (3 levels) in ' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/example.rb:51:in `instance_eval' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/example.rb:51:in `block in run' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/example.rb:110:in `with_around_hooks' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/example.rb:48:in `run' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:306:in `block in run_examples' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:302:in `map' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:302:in `run_examples' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:274:in `run' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:275:in `block in run' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:275:in `map' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/example_group.rb:275:in `run' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:24:in `block (2 levels) in run' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:24:in `map' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:24:in `block in run' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/reporter.rb:12:in `report' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:21:in `run' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:80:in `run_in_process' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:66:in `rescue in run' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:62:in `run' # .rvm/gems/ruby-1.9.3-p0@foo/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:10:in `block in autorun'
If you type bin/rspec --help
, you'll see a list of options and switches you can add to the command, including the --backtrace
switch, which tells RSpec to show you the full backtrace. If you run bin/rspec spec/requests/users/registrations_spec.rb --backtrace
you should see precisely where the error is coming from.
HTH, David
这篇关于Rails:为什么RSpec在我重写的Devise控制器请求规格上崩溃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!