Ruby On Rails Classroom image

prateek  darmwal / Professional / 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
prateek  darmwal

Skills    Ruby On Rails

Qualifications :- High School - S.K.M. Sn. Sec. School, Haldwani, College/University - Graphic Era Hill University, Bhimtal,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:- I like to explore new technologies. I have skills in ruby on rails, php5, cakephp, jquery, javascript, html/css, java, c & c++. I love coding
Explore
 

  Students (0)