Skip to content

Add documentation to recently added ActionMailbox methods #2122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions lib/rspec/rails/example/mailbox_example_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module MailboxExampleGroup
require 'action_mailbox/test_helper'
extend ::ActionMailbox::TestHelper

# @private
def self.create_inbound_email(arg)
case arg
when Hash
Expand All @@ -34,27 +35,32 @@ def mailbox_class
subject { described_class }
end

# Verify the status of any inbound email
# @api public
# Passes if the inbound email was delivered
#
# @example
# describe ForwardsMailbox do
# it "can describe what happened to the inbound email" do
# mail = process(args)
#
# # can use any of:
# expect(mail).to have_been_delivered
# expect(mail).to have_bounced
# expect(mail).to have_failed
# end
# end
# inbound_email = process(args)
# expect(inbound_email).to have_been_delivered
def have_been_delivered
satisfy('have been delivered', &:delivered?)
end

# @api public
# Passes if the inbound email bounced during processing
#
# @example
# inbound_email = process(args)
# expect(inbound_email).to have_bounced
def have_bounced
satisfy('have bounced', &:bounced?)
end

# @api public
# Passes if the inbound email failed to process
#
# @example
# inbound_email = process(args)
# expect(inbound_email).to have_failed
def have_failed
satisfy('have failed', &:failed?)
end
Expand Down