Sha256: 04dd13cc5d64878cbe9262ee7fcf5380940c1b64713cef2a0d6803911ece65c0
Contents?: true
Size: 1.66 KB
Versions: 3
Compression:
Stored size: 1.66 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper' describe UserObserver do def valid_attributes { :full_name => 'Test User Name', :email => 'Test@UserName.com', :login => 'test', :time_zone => "WOW", :phone => "0408 505 1234", :password => 'test_password', :password_confirmation => 'test_password', :access_level => User::ACCESS_LEVEL_DISABLED } end describe "after create" do it "should deliver the welcome notification to the user" do UserMailer.should_receive(:deliver_welcome_message) User.create(valid_attributes) end it "should not deliver the welcome notification if deliveries are turned off" do ActionMailer::Base.stub(:perform_deliveries).and_return(false) UserMailer.should_not_receive(:deliver_welcome_message) User.create(valid_attributes) end end describe "after save" do before do @user = User.create(valid_attributes) end it "should not send forgot password after a regular save" do UserMailer.should_not_receive :deliver_forgot_password @user.stub!(:reset_token).and_return(nil) @user.full_name = "new" @user.save end it "should send password reset mail after user has been requested it to be reset" do UserMailer.should_receive :deliver_forgot_password User.set_reset_token(@user.email) end it "should not send password reset mail if deliveries are turned off" do ActionMailer::Base.stub(:perform_deliveries).and_return(false) UserMailer.should_not_receive :deliver_forgot_password User.set_reset_token(@user.email) end end end
Version data entries
3 entries across 3 versions & 1 rubygems