Search⌘ K
AI Features

The Second Test

Explore how to write and pass the second test in Rails test-driven development by introducing Task and Project classes. Understand making failing tests pass incrementally and applying logic for project completion while delaying ActiveRecord integration for clarity.

The next test

One nice feature of test-driven development is that making one test pass often points to the next test. The goal of the next test cycle is to write a test that fails, given the current code. At this point, the code says that done? is always true, so we should create a case where done? is false:

rsync -avr --progress /usercode/* /usr/local/educative/gatherer --exclude Gemfile --exclude Gemfile.lock --exclude execute.sh
cd /usr/local/educative/gatherer
npm install
clear
Adding a new test in project_spec.rb file

This test is similar to the first one, but now we have a second class, Task, and a related attribute of the Project class, tasks. This time we’re assuming that a new task is undone, and therefore a project with an undone task is not done. We could write the last line as ...