February 2018
Intermediate to advanced
406 pages
9h 52m
English
Were you to run the RSpec tests now that you’ve moved all the logic to JavaScript, you’d find that both tests in spec/system/add_task_spec.rb fail. The first test, which did not run in the JavaScript browser, fails because without JavaScript the tasks don’t display at all. That’s to be expected, and the test can be removed as its logic is now covered elsewhere.
The JavaScript test also fails for a couple of reasons. The simple one is the JavaScript makes a new Ajax call to get the JSON data for the tasks. To make that work, you need to make a small change to the ProjectsController#show method:
| | def show |
| | @project = Project.find(params[:id]) ... |