[rspec-users] Side Effects in Stories

s.ross cwdinfo at gmail.com
Fri Oct 19 16:22:32 EDT 2007

On Oct 19, 2007, at 12:21 PM, Jonathan Linowes wrote:

> from my specs on restful_authentication's models/user_observer_spec.rb
> context "A UserObserver" do
>   setup do
>     @user = mock('user')
>     @user_observer = UserObserver.instance
>   end
>   specify "should call UserNotifier.deliver_signup_notification on  
> user creation" do
>     UserNotifier.should_receive(:deliver_signup_notification).with 
> (@user)
>     @user.stub!(:pending?).and_return(true)
>     @user.stub!(:recently_activated?).and_return(false)
>     @user.stub!(:recently_forgot_password?).and_return(false)
>     @user_observer.after_save(@user)
>   end
> (sorry its in pre-1.0 format)

This is a great solution. I'll give it a try. I know about checking  
the mail queue but wasn't getting it done under the very first story  
runner. Again, I screwed up and didn't check in my files so they  
vaporized. Acckkk! Fortunately, it was just a proof of concept  
sandbox for me to test using the story runner :)


More information about the rspec-users mailing list