Ruby on Rails Monday, July 4, 2011

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/d2DUAY7ZAh0J.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment