On Oct 19, 2007, at 3:30 PM, Ben Mabey wrote: > <snip>
yes, upon closer inspection, (as in http://www.vaporbase.com/postings/ Rspec_1.0_and_Restful_Authentication) in spec_helper.rb def set_mailer_in_test ActionMailer::Base.delivery_method = :test ActionMailer::Base.perform_deliveries = true ActionMailer::Base.deliveries = [] end and models/user_notifier_spec.rb : context "A UserNotifier on signup_notification" do setup do set_mailer_in_test @user = mock("user") @user.stub!(:email).and_return('[EMAIL PROTECTED]') @user.stub!(:activation_code).and_return('code') @user.stub!(:login).and_return('user') @user.stub!(:password).and_return('password') @user_notifier = UserNotifier.create_signup_notification(@user) end specify "should set @recipients to user's email" do @user_notifier.to.should eql( ["[EMAIL PROTECTED]"] ) end specify "should set @subject to [YOURSITE] Please activate your new account" do @user_notifier.subject.should eql( "#{SITE_OPTIONS['sitename']}: Please activate your new account" ) end specify "should set @from to ADMINEMAIL" do @user_notifier.from.should eql( ["#{SITE_OPTIONS['adminemail']}"]) end specify "should contain login reminder (User: user) in mail body" do @user_notifier.body.should match( /Username: user/ ) end specify "should contain password reminder (Password: password) in mail body" do @user_notifier.body.should match( /Password: password/ ) end specify "should contain user activation url (http://YOURSITE/ activate/code) in mail body" do @user_notifier.body.should match( %r{http://#{SITE_OPTIONS ['sitedomain']}/activate/code} ) end end _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users