Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 872
Zardoz Avatar asked Jan 28 '26 00:01

Zardoz


2 Answers

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.

like image 151
lzap Avatar answered Jan 30 '26 14:01

lzap


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
like image 45
Jason Avatar answered Jan 30 '26 12:01

Jason



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!