The Second Test
One nice feature of test-driven development is that making one test pass often points the way 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.
basics_rspec/02/gatherer/spec/models/project_spec.rb | |
â | it â"knows that a project with an incomplete task is not done"â âdoâ |
â | project = Project.new |
â | task = Task.new |
â | project.tasks << task |
â | expect(project.done?).to be_falsy |
â | âendâ |
â | âendâ |
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 ...
Get Rails 4 Test Prescriptions now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.