mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 08:53:38 +08:00
Take 2 on ba6f11c521
.
This commit is contained in:
parent
2d96160192
commit
2c70d3f443
|
@ -91,7 +91,7 @@ module Jobs
|
|||
if reason_type == SkippedEmailLog.reason_types[:exceeded_emails_limit]
|
||||
exists = SkippedEmailLog.exists?({
|
||||
created_at: (Time.zone.now.beginning_of_day..Time.zone.now.end_of_day)
|
||||
}.merge(attributes))
|
||||
}.merge!(attributes.except(:post_id)))
|
||||
|
||||
return if exists
|
||||
end
|
||||
|
|
|
@ -134,6 +134,10 @@ describe Jobs::NotifyMailingListSubscribers do
|
|||
2.times do
|
||||
Jobs::NotifyMailingListSubscribers.new.execute(post_id: post.id)
|
||||
end
|
||||
|
||||
Jobs::NotifyMailingListSubscribers.new.execute(
|
||||
post_id: Fabricate(:post, user: user)
|
||||
)
|
||||
end.to change { SkippedEmailLog.count }.by(1)
|
||||
|
||||
expect(SkippedEmailLog.exists?(
|
||||
|
@ -143,6 +147,14 @@ describe Jobs::NotifyMailingListSubscribers do
|
|||
to_address: mailing_list_user.email,
|
||||
reason_type: SkippedEmailLog.reason_types[:exceeded_emails_limit]
|
||||
)).to eq(true)
|
||||
|
||||
freeze_time(Time.zone.now + 1.day)
|
||||
|
||||
expect do
|
||||
Jobs::NotifyMailingListSubscribers.new.execute(
|
||||
post_id: Fabricate(:post, user: user)
|
||||
)
|
||||
end.to change { SkippedEmailLog.count }.by(1)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user