Ruby On Rails Classroom image

Neha  Jaggi / Professional / Web Technology

To post your Question Join Classroom
Lesson Topics's No:-  |1 | 2|Last
Lessons:-Signup URI

Signup URI


With the code from Section 5.4.1, we already have a working page for new users at /users/new, but recall from Table 5.1 that we want the URI to be /signup instead. As in Section 5.3, we’ll first write some integration tests, which we’ll now generate:


$   rails  generate  integration _ test  user  pages


Then, following the model of the static pages spec in Listing 5.27, we’ll fill in the user pages test with code to test for the contents of the h1 and title tags, as seen in Listing 5.31.  


Listing 5.31 The initial spec for users, with a test for the signup page.




We can run these tests using the rspec command as usual:

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


It’s worth noting that we can also run all therequest specs by passing the whole directory instead of just one file:

bundle exec  rspec  spec / requests/


Based on this pattern, you may be able to guess how to run all the specs:

$  bundle  exec  rspec  spec/  


For completeness, we’ll usually use this method to run the tests through the rest of the tutorial. By the way, it’s worth noting (since you may see other people use it) that you can also run the test suite using the spec Rake task:  


$  bundle  exec  rake  spec


                      (In fact, you can just type rake by itself; the default behavior of rake is to run the test suite.)  

By construction, the Users controller already has a new action, so to get the test to pass all we need is the right route and the right view content. We’ll follow the examples from Listing 5.21 and add a match ’/signup’ rule for the signup URI (Listing 5.32).


Neha  Jaggi

Skills    Ruby On Rails

Qualifications :- High School - , College/University - Graphic Era Hill University, Dehradun, College/University - ,
Location :-Dehradun,Dehradun,UTTARAKHAND,India

Experienced Software Developer with a demonstrated history of working in the Information Technology and services industry. Skilled in Web Technologies (Ruby on Rails, PostgreSQL, php, Laravel and AJAX). 


  Students (0)