RubyMine,为什么我无法调试spec文件?

时间:2012-01-30 13:52:18

标签: ruby-on-rails debugging rubygems rspec rspec-rails

我正在尝试使用RubyMine调试规范测试,但是,我得到:

uninitialized constant QuizzesController

这是完整的错误:

  

快速调试器(ruby-debug-ide 0.4.17.beta8,ruby-debug-base   0.11.30.pre4)收听127.0.0.1:41134 /home/sam/Documents/RoR/course_builder/spec/controllers/quiz_spec.rb:1:in   <top (required)>': uninitialized constant QuizzesController (NameError) from /home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in 负载”       来自/home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in   block in load_spec_files' from /home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in 映射”       来自/home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in   load_spec_files' from /home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:18:in 运行”       来自/home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:80:in   run_in_process' from /home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:69:in 运行”       来自/home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:10:in   block in autorun' from /home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/ruby-debug-ide-0.4.17.beta8/lib/ruby-debug-ide.rb:127:in debug_load”       来自/home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/ruby-debug-ide-0.4.17.beta8/lib/ruby-debug-ide.rb:127:in   debug_program' from /home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/ruby-debug-ide-0.4.17.beta8/bin/rdebug-ide:95:in”       来自-e:1:load' from -e:1:in'

/quiz_spec.rb第1行是describe QuizzesController do

我只在尝试调试spec文件时才会出现此错误,如果我在没有调试的情况下运行它,spec文件将正常工作。

我正在使用spork,所有规格测试运行正常而无需调试,但是,我仍然试图调试其中任何一个,请帮忙吗?

这是我的环境:

RubyGems Environment:
RUBYGEMS VERSION: 1.8.10
RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [i686-linux]
INSTALLATION DIRECTORY: /home/sam/.rvm/gems/ruby-1.9.3-p0@global
RUBY EXECUTABLE: /home/sam/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
EXECUTABLE DIRECTORY: /home/sam/.rvm/gems/ruby-1.9.3-p0@global/bin
RUBYGEMS PLATFORMS:
  ruby
  x86-linux
GEM PATHS:
   /home/sam/.rvm/gems/ruby-1.9.3-p0@global
GEM CONFIGURATION:
   :update_sources => true
   :verbose => true
   :benchmark => false
   :backtrace => false
   :bulk_threshold => 1000
REMOTE SOURCES:
   http://rubygems.org/
----------------------
IDE: JetBrains RubyMine (EAP) RM-112.291, build #RM-112.291
OS: Linux 3.0.0-14-generic[i386]
Java: 1.6.0_23-b23
RubyMine SDK Environment:
Sdk: RVM: ruby-1.9.3-p0 [global]
Sdk Version: ver.1.9.3p0 ( revision 33570) p0
Ruby Interpreter: /home/sam/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
RVM Sdk: yes, gemset:global
RVM Home: /home/sam/.rvm
Sdk Language Level: 1.9
Sdk Load Path:
     /home/sam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1
     /home/sam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/i686-linux
     /home/sam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby
     /home/sam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/vendor_ruby/1.9.1
     /home/sam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/vendor_ruby/1.9.1/i686-linux
     /home/sam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/vendor_ruby
     /home/sam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1
     /home/sam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/i686-linux
     /home/sam/rubyMine4beta/rubystubs19
Sdk Gem paths:
     file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/bundler/gems
     file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems
Gems used for 'hope':
     kaminari (0.13.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/kaminari-0.13.0)
     coffee-rails (3.1.1, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/coffee-rails-3.1.1)
     rack (1.3.6, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rack-1.3.6)
     rspec-expectations (2.7.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rspec-expectations-2.7.0)
     actionmailer (3.1.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/actionmailer-3.1.0)
     rspec-mocks (2.7.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rspec-mocks-2.7.0)
     tilt (1.3.3, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/tilt-1.3.3)
     rspec-rails (2.7.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rspec-rails-2.7.0)
     client_side_validations (3.1.4, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/client_side_validations-3.1.4)
     diff-lcs (1.1.3, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/diff-lcs-1.1.3)
     tzinfo (0.3.31, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/tzinfo-0.3.31)
     bcrypt-ruby (3.0.1, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/bcrypt-ruby-3.0.1)
     sprockets (2.0.3, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/sprockets-2.0.3)
     database_cleaner (0.7.1, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/database_cleaner-0.7.1)
     simple_form (1.5.2, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/simple_form-1.5.2)
     rack-ssl (1.3.2, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rack-ssl-1.3.2)
     childprocess (0.3.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/childprocess-0.3.0)
     rdoc (3.12, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rdoc-3.12)
     foreigner (1.1.1, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/foreigner-1.1.1)
     ansi (1.4.1, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/ansi-1.4.1)
     coffee-script (2.2.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/coffee-script-2.2.0)
     validate_url (0.2.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/validate_url-0.2.0)
     rack-mount (0.8.3, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rack-mount-0.8.3)
     cocoon (1.0.15, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/cocoon-1.0.15)
     guard (0.10.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/guard-0.10.0)
     i18n (0.6.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/i18n-0.6.0)
     turn (0.8.3, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/turn-0.8.3)
     guard-spork (0.5.1, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/guard-spork-0.5.1)
     addressable (2.2.6, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/addressable-2.2.6)
     haml (3.1.4, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/haml-3.1.4)
     hike (1.2.1, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/hike-1.2.1)
     orm_adapter (0.0.6, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/orm_adapter-0.0.6)
     rspec-core (2.7.1, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rspec-core-2.7.1)
     sass (3.1.12, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/sass-3.1.12)
     erubis (2.7.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/erubis-2.7.0)
     metaclass (0.0.1, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/metaclass-0.0.1)
     jquery-rails (1.0.19, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/jquery-rails-1.0.19)
     selenium-webdriver (2.17.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/selenium-webdriver-2.17.0)
     builder (3.0.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/builder-3.0.0)
     json (1.6.5, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/json-1.6.5)
     rack-cache (1.0.3, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rack-cache-1.0.3)
     will_paginate (3.0.2, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/will_paginate-3.0.2)
     bundler (1.0.21, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.21)
     activeresource (3.1.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/activeresource-3.1.0)
     libv8 (3.3.10.4, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/libv8-3.3.10.4-x86-linux)
     factory_girl_rails (1.5.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/factory_girl_rails-1.5.0)
     warden (1.1.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/warden-1.1.0)
     uglifier (1.2.2, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/uglifier-1.2.2)
     execjs (1.2.13, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/execjs-1.2.13)
     sass-rails (3.1.5, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/sass-rails-3.1.5)
     rails (3.1.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rails-3.1.0)
     multi_json (1.0.4, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/multi_json-1.0.4)
     xpath (0.1.4, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/xpath-0.1.4)
     capybara-firebug (1.0.1, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/capybara-firebug-1.0.1)
     activemodel (3.1.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/activemodel-3.1.0)
     rubyzip (0.9.5, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rubyzip-0.9.5)
     rspec (2.7.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rspec-2.7.0)
     factory_girl (2.4.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/factory_girl-2.4.0)
     actionpack (3.1.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/actionpack-3.1.0)
     spork (0.9.0.rc9, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/spork-0.9.0.rc9)
     activesupport (3.1.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/activesupport-3.1.0)
     devise (1.5.2, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/devise-1.5.2)
     mime-types (1.17.2, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/mime-types-1.17.2)
     rake (0.9.2.2, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rake-0.9.2.2)
     nokogiri (1.5.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/nokogiri-1.5.0)
     sqlite3 (1.3.5, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/sqlite3-1.3.5)
     rb-fsevent (0.4.3.1, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rb-fsevent-0.4.3.1)
     therubyracer (0.9.9, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/therubyracer-0.9.9)
     launchy (2.0.5, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/launchy-2.0.5)
     mail (2.3.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/mail-2.3.0)
     capybara (1.1.2, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/bundler/gems/capybara-edd4283edfe7)
     polyglot (0.3.3, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/polyglot-0.3.3)
     activerecord (3.1.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/activerecord-3.1.0)
     treetop (1.4.10, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/treetop-1.4.10)
     rack-test (0.6.1, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/rack-test-0.6.1)
     arel (2.2.1, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/arel-2.2.1)
     mocha (0.10.1, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/mocha-0.10.1)
     coffee-script-source (1.2.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/coffee-script-source-1.2.0)
     railties (3.1.0, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/railties-3.1.0)
     ffi (1.0.11, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/ffi-1.0.11)
     thor (0.14.6, file:///home/sam/.rvm/gems/ruby-1.9.3-p0@global/gems/thor-0.14.6)

1 个答案:

答案 0 :(得分:1)

您应该将require 'spec_helper'放在规范文件的第一行。