Writin Test case

40 views
Skip to first unread message

avinash behera

unread,
Nov 15, 2012, 3:30:10 AM11/15/12
to rubyonra...@googlegroups.com
Hello,

I am new to writing test cases in ruby on rails.
This is a controller code

I am using "test_helper" in our application.

def edit
    @user = User.find_by_token(params[:id])

    if @user
      if @user.sent_at < 24.hours.ago
        redirect_to root_url, :alert => "Expired"
      elsif @user.status == "Active"
        redirect_to root_url, :alert => "Invitation"
      else
        @user.status = "Active"
        if @user.save
          redirect_to root_url, :notice => "Activated"
        else
          redirect_to root_url, :alert => "Problem"
        end  
      end
    end
end 

How to write testcase for this?

Thanks.
Avi

Avi

unread,
Nov 16, 2012, 7:05:46 AM11/16/12
to rubyonra...@googlegroups.com
Hello,

How to pass dynamic data to the controller from a test case?

Fahim Patel

unread,
Nov 17, 2012, 1:56:08 AM11/17/12
to rubyonra...@googlegroups.com
May i know which testing framework u r using ?
 
Thanks 

Best Regards
Fahim Babar Patel
Reply all
Reply to author
Forward
0 new messages