No commit activity in last 3 years
No release in over 3 years
Shoulda macros and more assertions for Action Mailer and ActionMailer::TestCase; now includes tests for parts.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Action Mailer Shoulda Macros (and maybe assertions, too)

While Shoulda does ship with some Action Mailer assertions, it does not ship with standard macros that would help in testing Action Mailer emails. Macros such as:

  • should_have_subject
  • should_have_to_recipient
  • should_have_to_recipients - notice the plurality!
  • should_have_from
  • should_have_reply_to
  • should_match_body
  • should_have_mime_parts - also with counts
  • should_have_mime_content_type
  • should_use_charset
  • should_be_inlined_content
  • should_be_an_attachment - also with a check for filename
  • should_have_filename

Incidentally, those happen to be all the macros supported for now. We fully intend to have macros for everything in Action Mailer, but didn't have a need for any others yet (read: nothing forced us to write them yet). So, if you have a need for some others, please feel MORE THAN FREE to fork, add, and send a pull request so we can add them in.

For documentation, just look at the only file in the lib directory for now. Or, install the gem and the rdoc with it.

Installing & Using

Install as a gem:

sudo gem install thumblemonks-shoulda_action_mailer

And then do this in your test_helper.rb (or whatever you call it for your environment):

require 'shoulda_action_mailer'

Or, just tell Rails about them by doing this in your app's test.rb:

config.gem 'thumblemonks-shoulda_action_mailer', :lib => false, :source => 'http://gems.github.com'

Uh ... where are the tests?

I feel kind of bad not having tests here, but I actually did write these macros as refactorings to tests I already had in a certain other project that shall remain nameless for the time being. So, I don't really feel compelled to add any tests here unless someone asks me or I just decide to modify this code for random reason.

I hope that satisfies you.

Contact

Justin Knowlden gus@gusg.us

License

See LICENSE