ruby on rails - How to Design Rspec tests? -


i've gone through tutorials , i've learned basics of rspec. i'm trying make web app, basic first feature search box on main page has dropdown box , postal code entry. options difference car brands (toyota, ford, etc.) , intend them have same route (/search), show table of locations, cars sold per year , distance. mind blanking in regards tests write (design wise, not code). want develop habit, i'd appreciate ideas.

i assume search backed controller. start test individual methods in controller, e.g. posting search search method. here things test:

  • does search controller , method searches exist? e.g. no 404 or 500 thrown app
  • how should behave if empty query being done controller?
  • how should react if nothing found? 404? empty list? => test it
  • then move on actual searching:
    • populate database things can found
    • search , see if return of method includes looking for

so, these things start tests for...


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -