Add ability to fetch the next email for a given recipient #17

Closed
thbar opened this Issue Jan 21, 2013 · 5 comments

3 participants

@thbar

Hi!

thanks for capybara-email first!

Today I wanted to fetch the next email received by a given recipient, and ended up doing this as a quick work-around:

    def read_current_email_from_email_box!(recipient)
      self.current_email = emails_sent_to(recipient).first
      # TODO: patch capybara-email to allow to fetch the first email for a given recipient instead of doing this
      # Keeping a guard until we do that
      all_emails[0].to.should == [recipient]
      all_emails.delete_at(0)
    end

If I write something to allow to "remove the next email for a given user, assert it's here, and remove it from the deliveries queue", would you integrate it?

Thanks!

@bcardarella
⚓️ DockYard ⚓️ member

Perhaps a utility method something like:

def fetch_next_email_for(recipient)
   emails = emails_sent_to(recipient)
   if current_email.nil?
     emails[0]
  else
    self.current_email = emails[emails.find_index(current_email) + 1]
  end
end

Unfortunately I don't have the time to do add this right now.

@bcardarella bcardarella reopened this Jan 21, 2013
@thbar

Hey Brian - I can write some tests and code and send a PR if you'd like (I was more looking for an opinion before providing a patch, than asking for you to implement something!).

@bcardarella
⚓️ DockYard ⚓️ member

@thbar that would be great! :)

@thbar

When I do that, should I work against master or stable-1-0 branch? I saw your comment in the readme, not sure if it's still applies or not. Thanks!

@bcardarella
⚓️ DockYard ⚓️ member

@thbar sorry I missed your responses. This should be against 1-0-stable

@maabernethy maabernethy closed this Jan 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment