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]
|
if reason_type == SkippedEmailLog.reason_types[:exceeded_emails_limit]
|
||||||
exists = SkippedEmailLog.exists?({
|
exists = SkippedEmailLog.exists?({
|
||||||
created_at: (Time.zone.now.beginning_of_day..Time.zone.now.end_of_day)
|
created_at: (Time.zone.now.beginning_of_day..Time.zone.now.end_of_day)
|
||||||
}.merge(attributes))
|
}.merge!(attributes.except(:post_id)))
|
||||||
|
|
||||||
return if exists
|
return if exists
|
||||||
end
|
end
|
||||||
|
|
|
@ -134,6 +134,10 @@ describe Jobs::NotifyMailingListSubscribers do
|
||||||
2.times do
|
2.times do
|
||||||
Jobs::NotifyMailingListSubscribers.new.execute(post_id: post.id)
|
Jobs::NotifyMailingListSubscribers.new.execute(post_id: post.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Jobs::NotifyMailingListSubscribers.new.execute(
|
||||||
|
post_id: Fabricate(:post, user: user)
|
||||||
|
)
|
||||||
end.to change { SkippedEmailLog.count }.by(1)
|
end.to change { SkippedEmailLog.count }.by(1)
|
||||||
|
|
||||||
expect(SkippedEmailLog.exists?(
|
expect(SkippedEmailLog.exists?(
|
||||||
|
@ -143,6 +147,14 @@ describe Jobs::NotifyMailingListSubscribers do
|
||||||
to_address: mailing_list_user.email,
|
to_address: mailing_list_user.email,
|
||||||
reason_type: SkippedEmailLog.reason_types[:exceeded_emails_limit]
|
reason_type: SkippedEmailLog.reason_types[:exceeded_emails_limit]
|
||||||
)).to eq(true)
|
)).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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue