LoginSignup
6
2

More than 1 year has passed since last update.

#Rails #rspec で SQLクエリ発行を標準出力する

Last updated at Posted at 2020-03-30

ActiveRecord::Base.logger = Logger.new(STDOUT) をどこかに書くだけでok

よく使う場合は rails_helper に定義するなり、 before after できれいに処理するなりするする

require 'rails_helper'

RSpec.describe do
  before do
    ActiveRecord::Base.logger = Logger.new(STDOUT)
  end

  it do
    ...
  end
end

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2