(urgent) Testing Controller of Rails

6 views
Skip to first unread message

Yennie

unread,
Jul 4, 2011, 2:42:56 PM7/4/11
to rubyonra...@googlegroups.com
Hi, 

I am a new comer of testing on rails . 
I am trying to testing my controller, and read a lot of testing using rspec and shoulda.
can anyone give me some examples about those rspec. 
cuz sometime i did not understand how to use rspec for the controller.

 def create
    @user = User.new(params[:user])
    
    @user.is_admin = false
    @user.enabled = false
    
    if @user.save
      redirect_to :action => "confirm"
    else
      @cultures  = Culture.where(:enabled => true)
      @languages = Language.where(:enabled => true)
      render "new"
    end
  end

  def show
    redirect_to :action => "edit"
    
  end

if my controller like that.. how can i test by using rspec.. please help

Reply all
Reply to author
Forward
0 new messages