medihack
medihack

Reputation: 16627

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?

Upvotes: 3

Views: 1129

Answers (2)

Jason
Jason

Reputation: 12313

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

Upvotes: 1

lzap
lzap

Reputation: 17173

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.

Upvotes: 1

Related Questions