Ruby On Rails Classroom image

Pooja  Negi / Student / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  ||
Lessons:- Route Tests

  Route Tests

With the work we’ve done writing integration test for the static pages, writing tests for the routes is simple: We just replace each occurrence of a hard-coded address with the desired named route from Table 5.1. In other words, we change

 

visit      '/static pages/about'

 

to

  visit  about   path

 

and so on for the other pages. The result appears in Listing 5.20.

 

Listing 5.20 Tests for the named routes.
spec/requests/static_pages_spec.rb 

 

                                         

                                           

                                                   

 

 

As usual, you should check that the tests are now red:

$   bundle  exec  rspec  spec/requests/static  pages  spec.rb

 

                     By the way, if the code in Listing 5.20 strikes you as repetitive and verbose, you’re not alone. We’ll refactor this mess into a beautiful jewel in Section 5.3.4.  

 
 
 
image
Pooja   Negi

Skills    Ruby On Rails

Qualifications :- High School - SSN high school, College/University - HNBGU, College/University - SRHU,
Location :-Ranipokhari,Rishikesh,Uttarakhand,India
Description:- Student
Explore
 

  Students (0)