spec/unit/lib/mail_adapters/mailgun_spec.rb in howitzer-2.0.0 vs spec/unit/lib/mail_adapters/mailgun_spec.rb in howitzer-2.0.1
- old
+ new
@@ -27,11 +27,11 @@
end
describe '.find' do
let(:mailgun_message) { double(to_h: message) }
let(:events) { double(to_h: { 'items' => [event] }) }
- subject { Howitzer::MailAdapters::Mailgun.find(recipient, message_subject) }
+ subject { Howitzer::MailAdapters::Mailgun.find(recipient, message_subject, wait: 0.01) }
context 'when message is found' do
let(:event) do
{
'message' => {
@@ -48,14 +48,14 @@
end
before do
allow(Howitzer::MailgunApi::Connector.instance.client).to receive(:get).with(
'mailgun@test.domain/events',
params: { event: 'stored' }
- ).ordered.once { events }
+ ) { events }
allow(Howitzer::MailgunApi::Connector.instance.client).to receive(:get_url).with(
'https://si.api.mailgun.net/v3/domains/mg.strongqa.com/messages/1234567890'
- ).ordered.once { mailgun_message }
+ ) { mailgun_message }
end
it do
expect(Howitzer::Email.adapter).to receive(:new).with(message).once
subject
end
@@ -78,10 +78,10 @@
end
before do
allow(Howitzer::MailgunApi::Connector.instance.client).to receive(:get).with(
'mailgun@test.domain/events',
params: { event: 'stored' }
- ).at_least(:twice).ordered { events }
+ ) { events }
end
it do
expect { subject }.to raise_error(
Howitzer::EmailNotFoundError,
"Message with subject '#{message_subject}' for recipient '#{recipient}' was not found."