简体   繁体   中英

Guard-rspec Rails Odd Output

I'm new to Rails and Guard and I'm watching a screencast where it seems to output the number of errors, examples, etc. However, when I run it, I recieve the following output:

    18:31:11 - INFO - Running: spec/controllers/tasks_controller_spec.rb
/Users/Phil/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit/testcase.rb:9:in `<class:TestCase>': uninitialized constant Test::Unit::TestCase::Assertions (NameError)
    from /Users/Phil/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit/testcase.rb:8:in `<module:Unit>'
    from /Users/Phil/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit/testcase.rb:4:in `<module:Test>'
    from /Users/Phil/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit/testcase.rb:3:in `<top (required)>'
    from /Users/Phil/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb:5:in `<top (required)>'
    from /Users/Phil/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit/assertions.rb:4:in `<top (required)>'
    from /Users/Phil/.rvm/gems/ruby-1.9.3-p448/gems/rspec-rails-2.14.0/lib/rspec/rails/adapters.rb:3:in `<top (required)>'
    from /Users/Phil/.rvm/gems/ruby-1.9.3-p448/gems/rspec-rails-2.14.0/lib/rspec/rails.rb:11:in `<top (required)>'
    from /Users/Phil/rails/tasks/spec/spec_helper.rb:4:in `<top (required)>'
    from /Users/Phil/rails/tasks/spec/controllers/tasks_controller_spec.rb:1:in `require'
    from /Users/Phil/rails/tasks/spec/controllers/tasks_controller_spec.rb:1:in `<top (required)>'
    from /Users/Phil/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.3/lib/rspec/core/configuration.rb:896:in `load'
    from /Users/Phil/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.3/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
    from /Users/Phil/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.3/lib/rspec/core/configuration.rb:896:in `each'
    from /Users/Phil/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.3/lib/rspec/core/configuration.rb:896:in `load_spec_files'
    from /Users/Phil/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.3/lib/rspec/core/command_line.rb:22:in `run'
    from /Users/Phil/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.3/lib/rspec/core/runner.rb:80:in `run'
    from /Users/Phil/.rvm/gems/ruby-1.9.3-p448/gems/rspec-core-2.14.3/lib/rspec/core/runner.rb:17:in `block in autorun'

Am I doing something wrong?

事实证明,至少就我而言,我不得不去除宝石的“回合”,从而固定了整个物件。

You're seeing the output of rspec processing your spec files, which is normal. If your specs run without exception, then you'll simply see the success/failure reports. However, if your specs raise an error, then you'll the stack trace, as you're seeing in this case. You should look at the trace and determine where in your specs and/or application code your error(s) may exist.

In your stack trace (the whole bunch of lines you posted) you got the answer to your question.

Seek for the lines that are pointing to files located into your project, those start with the path "/Users/Phil/rails/"

The first one point to "/Users/Phil/rails/tasks/spec/controllers/tasks_controller_spec.rb" line 1 and seems to complain about the require statement. That's where you should start your investigation.

This is the basic principle of testing: you got an error, you find its location, then find its reason, and finally fix it :)

Good luck

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM