开发者

How do I make the output from tests a little less verbose (with BacktraceCleaner?) in Rails 3

I want to filter out most of this, so I don't have to scroll up after each failed test:

1) Error:
test_should_get_index(AuthenticationsControllerTest):
NoMethodError: undefined method `bupp=' for nil:NilClass
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/activesupport-3.0.3/lib/active_support/whiny_nil.rb:48:in `method_missing'
    /home/ke/prj/xxxxxgemset/app/controllers/authentications_controller.rb:5:in `index'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/actionpack-3.0.3/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/actionpack-3.0.3/lib/abstract_controller/base.rb:151:in `process_action'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/actionpack-3.0.3/lib/action_controller/metal/rendering.rb:11:in `process_action'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/actionpack-3.0.3/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:435:in `_run__619633257__process_action__113944335__callbacks'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/activesupport-3.0.3/lib/active_support/callbacks.rb:93:in `run_callbacks'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/actionpack-3.0.3/lib/abstract_controller/callbacks.rb:17:in `process_action'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/actionpack-3.0.3/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/activesupport-3.0.3/lib/active_support/notifications.rb:52:in `block in instrument'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/activesupport-3.0.3/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/activesupport-3.0.3/lib/active_support/notifications.rb:52:in `instrument'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/actionpack-3.0.3/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/actionpack-3.0.3/lib/action_controller/metal/rescue.rb:17:in `process_action'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/actionpack-3.0.3/lib/abstract_controller/base.rb:120:in `process'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/actionpack-3.0.3/lib/abstract_controller/rendering.rb:40:in `process'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/actionpack-3.0.3/lib/action_controller/metal/testing.rb:12:in `process_with_new_base_test'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/actionpack-3.0.3/lib/action_controller/test_case.rb:412:in `process'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/actionpack-3.0.3/lib/action_controller/test_case.rb:47:in `process'
    /home/ke/.rvm/gems/ruby-1.9.2-p0@xxxxxgemset/gems/actionpack-3.0.3/lib/action_controller/test_case.rb:350:in `get'
    test/functional/authentications_controller_test.rb:12:in `block in <class:AuthenticationsControllerTest>'

41 tests开发者_运维问答, 62 assertions, 0 failures, 1 errors, 0 skips

Test run options: --seed 43906
Errors running test:functionals!

I've tried to use ActiveSupport::BacktraceCleaner, but I don't understand how to use it. I added

Rails.backtrace_cleaner.add_silencer { |line| line =~ /actionpack/ }

to config/initializers/backtrace_silencers.rb, as the instructions in that file say, but it makes no difference.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜