Ruby On Rails Classroom image

Pooja  Negi / Student / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2|
Lessons:-User Validations

These kinds of tests allow us to use TDD to add new attributes and methods to our User model, and as a side effect we get a nice specification for the methods that all User objects should respond to.

         You should verify at this point that the tests fail

$ bundle exec rspec spec/

 

Even though we created a development database with rake db:migrate in Section 6.1.1, the tests fail because the test database doesn’t yet know about the data model (indeed, it doesn’t yet exist at all). We can create a test database with the correct structure, and thereby get the tests to pass, using the db:test:prepare Rake task:  

 

$ bundle exec rake db:test:prepare

 

This justensures that the data model from the development database, db/development .sqlite3, is reflected in the test database, db/test.sqlite3. Failure to run this Rake task after a migration is a common source of confusion. In addition, sometimes the test database gets corrupted and needs to be reset. If your test suite is mysteriously breaking, be sure to try running rake db:test:prepare to see if that fixes the problem

 

 
 
 
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)