テスト環境で user_mailer.rb をデバッグしようとしています。しかし、デバッガーが停止するはずの場所で停止しない理由がわかりません。
だから、私がおおよそ持っているコードは次のとおりです。
user_mailer_spec.rb
describe UserMailer do
describe '#send_notification_letters' do
# bunch of code omitted here ...
it 'should record itself to the database'
expect { UserMailer.send_notification_letters(user) }.to change{SentMail.count}.by(1)
end
end
end
のuser_mailer.rb
class UserMailer < ActionMailer::Base
def send_notification_letters(user)
byebug # should break here but doesnt,
# also tried binding.pry here, also doesnt work
# buggy code ...
# buggy code ...
# buggy code ...
SentMail.create(...) # never reached
mail(to:..., from:...)
end
end
user_mail.rb
問題は、テストを実行したときに byebug/pry が停止しないのはなぜrspec spec/mailer/user_mailer_spec.rb
ですか?
なぜ?
そのブレークポイントで停止させるにはどうすればよいですか?
デバッガにバグはありますか?