Back on Task
What remains of our definition of done? is the distinction between complete and incomplete tasks. Letâs start with that, with a test for Task:
basics_rspec/03/gatherer/spec/models/task_spec.rb | |
â | require â'rails_helper'â |
â | |
â | RSpec.describe Task âdoâ |
â | it â"can distinguish a completed task"â âdoâ |
â | task = Task.new |
â | expect(task).not_to be_complete |
â | task.mark_completed |
â | expect(task).to be_complete |
â | âendâ |
â | âendâ |
This test makes two assertions, which I normally try to avoid, but the two assertions in this test are pretty intimately relatedâit would be awkward to separate them. We create a new Task (expecting that it is not complete at this point), then we complete the task and ...
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.