1
rspecのコンテキストに条件フィルタを設定する方法はありますか?rspecのコンテキストの条件付きフィルタ?
私は、特定の変数!= 1の場合にのみ有効な変数を持つコンテキストを持っているので、そのコンテキストのテストのフィルタとして使用したいと思います。
context 'if interval is not 1 every non interval day', :if => Reminders::INTERVAL != 1 do
num = rand(0..100)
non_limbo = num + num/(Reminders::INTERVAL - 1) + 1
let!(:evaluation) { create(:evaluation, created_at: non_limbo.days.ago) }
it 'doesn't send an email' do
expect { subject }.to change { ActionMailer::Base.deliveries.count }.by(0)
end
end