运行rspec时删除注释

时间:2016-12-08 13:15:41

标签: ruby-on-rails rspec-rails

当我使用rspec测试我的rails应用程序时,会出现一堆长评论。 我该如何删除它们?

 ActionController::RoutingError:
   No route matches [GET] "/events"
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:36:in `call_app'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in `block in call'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in `call'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/method_override.rb:22:in `call'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/runtime.rb:22:in `call'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/sendfile.rb:111:in `call'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:522:in `call'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/urlmap.rb:68:in `block in call'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/urlmap.rb:53:in `each'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/urlmap.rb:53:in `call'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/rack-test-0.6.3/lib/rack/mock_session.rb:30:in `request'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/rack-test-0.6.3/lib/rack/test.rb:244:in `process_request'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/rack-test-0.6.3/lib/rack/test.rb:58:in `get'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/rack_test/browser.rb:61:in `process'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/rack_test/browser.rb:36:in `process_and_follow_redirects'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/rack_test/browser.rb:22:in `visit'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/rack_test/driver.rb:43:in `visit'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/session.rb:233:in `visit'
 # /Users/hadi/.rvm/gems/ruby-2.3.0/gems/capybara-2.7.1/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
 # ./spec/features/list_movies_spec.rb:5:in `block (2 levels) in <top (required)>'

1 个答案:

答案 0 :(得分:1)

这不是评论的堆栈跟踪,以帮助您解决rspec遇到的问题。

堆栈跟踪向您显示每个嵌套调用,该调用是在遇到错误时进行的,这样您就可以追溯到代码中运行导致错误的命令行。

你的spec/features/list_movies_spec.rb在第5行,他们执行了一种方法,在某些时候尝试做“GET / events&#39;但是你的路线中没有这样的路线.rb

解决问题,以及&#34;评论&#34;将消失。