Skip to content

Instantly share code, notes, and snippets.

@dgalarza
Created August 14, 2010 15:26
Show Gist options
  • Save dgalarza/524404 to your computer and use it in GitHub Desktop.
Save dgalarza/524404 to your computer and use it in GitHub Desktop.
describe Notifications, :type => :helper do #setting type is necessary
before(:each) do
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries = []
end
it “should sent a nice email with the analyses to the user” do
analysis_observer = AnalysisObserver.instance
# Stub out the after create observation
analysis_observer.stub!(:after_create)
mail = Notifications.deliver_analyses_to_user “somegmail@gmail.com”, Factory(:temporary_user, :analyses =>[Factory(:analysis)])
# Check to see that the email was added to the queue for sending
ActionMailer::Base.deliveries.size.should == 1
# Could also verify contents of the email
# mail.body.should have_tag(”img”, 3)
# mail.body.should have_tag(”table”)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment