Forum: Ruby on Rails Writin Test case

Posted by avinash behera (Guest)
on 2012-11-15 09:32
(Received via mailing list)
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
Posted by Avi (Guest)
on 2012-11-16 13:06
(Received via mailing list)
Hello,

How to pass dynamic data to the controller from a test case?
Posted by fahim patel (fahim_patel)
on 2012-11-17 07:57
(Received via mailing list)
May i know which testing framework u r using ?

Thanks

Best Regards
Fahim Babar Patel
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.