Ruby On Rails Classroom image

Anil  Bist / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4 | 5|Last
Lessons:- Edit Form

For convenience, the code in Listing 9.5 uses a helper to sign in a user inside the tests. The method is to visit the signin page and submit valid information, as shown in Listing 9.6

 

As noted in the comment line, filling in the form doesn’t work when not using Capybara, so to cover this case we also add the user’s remember token to the cookies:

# Sign in when not using Capybara as well.
cookies  [:remember token] =  user.remember token

 

This is necessary when using one of the HTTP request methods directly (get, post, put, or Delete), as we’ll see in Listing 9.47. (Note that the test cookies object isn’t a perfect simulation of the real cookies object; in particular, the cookies.permanent method seen in Listing 8.19 doesn’t work inside tests.) As you might suspect, the sign_in method will prove useful in future tests, and in fact it can already be used to eliminate some duplication (Section 9.6).

       The application code to add the URI for the ‘‘Settings’’ link is simple: We just use the named route edit_user_path from Table 7.1, together with the handy current_user helper method defined in Listing 8.22:

<%=  link to  "Settings", edit user path(current user)  %>  

 

 

 
 
 
image
Anil  Bist

Skills    Ruby On Rails

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-

I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore

 

  Students (0)