开发者

Show server output when running request specs

开发者 https://www.devze.com 2023-03-04 15:38 出处:网络
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 wa

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

精彩评论

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

关注公众号