CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Sat, 23 Aug 2025 08:37:25 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20090822024456
location: https://web.archive.org/web/20090822024456/https://github.com/bmabey/email-spec/tree/master
server-timing: captures_list;dur=0.624817, exclusion.robots;dur=0.020817, exclusion.robots.policy;dur=0.009960, esindex;dur=0.010815, cdx.remote;dur=183.072245, LoadShardBlock;dur=239.023739, PetaboxLoader3.datanode;dur=51.079426, PetaboxLoader3.resolve;dur=31.648787
x-app-server: wwwb-app221
x-ts: 302
x-tr: 475
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=1
set-cookie: wb-p-SERVER=wwwb-app221; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Sat, 23 Aug 2025 08:37:25 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.6.31
x-archive-orig-date: Sat, 22 Aug 2009 02:44:55 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-x-runtime: 174ms
x-archive-orig-etag: "8a46754d5ce6429c924c81f5b72a5c8e"
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-orig-content-length: 32633
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Sat, 22 Aug 2009 02:44:56 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Sat, 24 Jan 2009 02:19:07 GMT", ; rel="prev memento"; datetime="Fri, 14 Aug 2009 05:40:51 GMT", ; rel="memento"; datetime="Sat, 22 Aug 2009 02:44:56 GMT", ; rel="next memento"; datetime="Thu, 17 Sep 2009 02:43:03 GMT", ; rel="last memento"; datetime="Sat, 11 Jun 2016 08:32:36 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_11_20090822005455_crawl100.gpg-c/52_11_20090822024450_crawl101.arc.gz
server-timing: captures_list;dur=0.555409, exclusion.robots;dur=0.020396, exclusion.robots.policy;dur=0.008864, esindex;dur=0.011342, cdx.remote;dur=148.558062, LoadShardBlock;dur=125.965852, PetaboxLoader3.datanode;dur=133.489108, PetaboxLoader3.resolve;dur=203.619059, load_resource;dur=232.732764
x-app-server: wwwb-app221
x-ts: 200
x-tr: 603
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
bmabey's email-spec at master - GitHub
This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (

This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (

Run the following if you haven't already:
gem sources -a https://gems.github.com
Install the gem(s):
sudo gem install bmabey-email_spec
Description: | Collection of rspec matchers and cucumber steps for testing email in a rails app edit |
Homepage: | https://benmabey.com edit |
Public Clone URL: |
git://github.com/bmabey/email-spec.git
Give this clone URL to anyone.
git clone git://github.com/bmabey/email-spec.git
|
Your Clone URL: |
Use this clone URL yourself.
git clone git@github.com:bmabey/email-spec.git
|
README.rdoc
Email Spec
A collection of RSpec matchers and Cucumber steps to make testing emails go smoothly.
Setup
script/plugin install git://github.com/bmabey/email-spec.git
Gem Setup
gem install bmabey-email_spec # config/environments/test.rb config.gem 'bmabey-email_spec', :lib => 'email_spec'
Cucumber
To use the steps in features put the following in your env.rb:
# Make sure this require is after you require cucumber/rails/world. require 'email_spec/cucumber'
This will load all the helpers that the steps rely on. It will also add a Before hook for Cucumber so that emails are cleared at the start of each scenario.
Then:
script/generate email_spec
This will give you a bunch of steps to get started with in step_definitions/email_steps.rb
RSpec
First you need to require the helpers and matchers in your spec_helper.rb like so: require "email_spec/helpers" require "email_spec/matchers" You will then need to include EmailSpec::Helpers and EmailSpec::Matchers in your example groups. If you want to have access to the helpers and matchers in all of your examples you can do the following in your spec_helper.rb: Spec::Runner.configure do |config| config.include(EmailSpec::Helpers) config.include(EmailSpec::Matchers) end Otherwise, you will need to include them in the example groups you wish to use them: describe "Signup Email" do include EmailSpec::Helpers include EmailSpec::Matchers ... end
Usage
Cucumber
Scenario: A new person signs up Given I am at "/" When I fill in "Email" with "quentin@example.com" And I press "Sign up" And I should receive an email When I open the email Then I should see "confirm" in the email When I follow "confirm" in the email Then I should see "Confirm your new account"
For more examples, check out examples/rails_root in the source for a small example app that implements these steps.
RSpec
==== Testing In Isolation ==== It is often useful to test your mailers in isolation. You can accomplish this by using mocks to verify that the mailer is being called in the correct place and then write focued examples for the actual mailer. This is a simple example from the sample app found in the gem: Verify that the mailer is used correctly in the controller (this would apply to a model as well): describe "POST /signup (#signup)" do it "should deliver the signup email" do # expect UserMailer.should_receive(:deliver_signup).with("email@example.com", "Jimmy Bean") # when post :signup, "Email" => "email@example.com", "Name" => "Jimmy Bean" end end Examples for the #signup method in UserMailer: describe "Signup Email" do include EmailSpec::Helpers include EmailSpec::Matchers include ActionController::UrlWriter before(:all) do @email = UserMailer.create_signup("jojo@yahoo.com", "Jojo Binks") end it "should be set to be delivered to the email passed in" do @email.should deliver_to("jojo@yahoo.com") end it "should contain the user's message in the mail body" do @email.should have_text(/Jojo Binks/) end it "should contain a link to the confirmation link" do @email.should have_text(/#{confirm_account_url}/) end it "should have the correct subject" do @email.should have_subject(/Account confirmation/) end end ==== Using the helpers when not testing in isolation ==== Don't. :) Seriously, if you do just take a look at the helpers and use them as you wish.
Original Authors
Ben Mabey, Aaron Gibralter, Mischa Fierer
Please see History.txt for upcoming changsets and other contributors.
This feature is coming soon. Sit tight!