daily pastebin goal
30%
SHARE
TWEET

Untitled

a guest Mar 8th, 2018 147 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require File.dirname(__FILE__) + '/../spec_helper'
  2.  
  3. describe UserController do
  4.  
  5.   before(:each) do
  6.     @user  = mock_model(User)
  7.     @role  = mock_model(Role)
  8.     @user.stub!(:new_record?).and_return(false)
  9.     @user.stub!(:valid?).and_return(true)
  10.     @user.stub!(:roles).and_return([@role])
  11.  
  12.     User.stub!(:new).and_return(@user)
  13.     Advertiser.stub!(:new).and_return(@user)
  14.     User.stub!(:find).and_return(@user)
  15.  
  16.  
  17.   end
  18.  
  19.   it "should render 'user/signup' on GET to signup" do
  20.     get 'signup'
  21.     response.should render_template(:signup)
  22.   end
  23.  
  24.   it "should tell the User model to create a new User on POST to signup and then redirect to index" do
  25.  
  26.     @user.stub!(:save).and_return( true )
  27.     @user.should_receive(:status=).with(USER_WAIT_APPROVAL).and_return( true )
  28.     @user.stub!(:confirmation=).and_return( true )
  29.     @user.should_receive(:name).and_return("Lee")
  30.     @user.should_receive(:email).and_return("lma-admin@lma.com")
  31.     @role.should_receive(:name).and_return("advertiser")
  32.  
  33.     post 'signup', {:user => {
  34.                      :login => "lma-admin", :email => "lma-admin@lma.com", \
  35.                      :first_name => "Bruce", :last_name => "Lee", \
  36.                      :company_name => "Jeet Kune Do", :city => "San Fracisco", \
  37.                      :phone_nr => "123-45678", :password => "LeeHoiChuen", \
  38.                      :password_confirmation => "LeeHoiChuen", \
  39.                      :country => "Estados Unidos", :type => "advertiser"}}
  40.  
  41.     response.should redirect_to(:action => 'index')
  42.  
  43.   end
  44.  
  45. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top