How to get Rails.logger printing to the console/stdout when running rspec?

前端 未结 5 1551
温柔的废话
温柔的废话 2020-12-04 15:08

Same as title: How to get Rails.logger printing to the console/stdout when running rspec? Eg.

Rails.logger.info \"I WANT this to go to console/s         


        
5条回答
  •  猫巷女王i
    2020-12-04 15:35

    You can define a method in spec_helper.rb that sends a message both to Rails.logger.info and to puts and use that for debugging:

    def log_test(message)
        Rails.logger.info(message)
        puts message
    end
    

提交回复
热议问题