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
精彩评论