summaryrefslogtreecommitdiff
path: root/spec/support/email_helpers.rb
blob: a85ab22ce36fc814a2f5603d8d5f528a484f46ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
module EmailHelpers
  def sent_to_user?(user)
    ActionMailer::Base.deliveries.map(&:to).flatten.count(user.email) == 1
  end

  def should_email(user)
    expect(sent_to_user?(user)).to be_truthy
  end

  def should_not_email(user)
    expect(sent_to_user?(user)).to be_falsey
  end
end