开发者

Show server output when running request specs

I use RSpec for integration tests. Unfortunately when running those request specs I often miss important errors as I don't directly see the output of开发者_开发百科 the test web server. Is there a way to get this stuff on the console, too?


If you mean server logs it should be something like this:

if rails_env = ENV['RAILS_ENV']
  require 'logger'
  logger = Logger.new(STDOUT)
  ActiveRecord::Base.logger = logger
  ActiveResource::Base.logger = logger
  Rails.logger = logger
end

Not sure about server output.


The output of the server during testing goes to log/test.log in your rails app directory. You can view it with

$ cat log/test.log

or, if you want something of a real time view,

$ watch -c -n 1 tail -40 log/test.log
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜