Making the Capybara Test Pass
Let’s go through the integration-test process.
Our first error is right on the first line: projects(:bluebook) is a call to a fixture method, but we haven’t defined any fixture named bluebook. That’s easy enough to fix. We need to add some fixture files to the spec directory:
integration/01/gatherer/spec/fixtures/projects.yml | |
| one: |
| name: MyString |
| due_date: 2013-11-10 |
| |
| two: |
| name: MyString |
| due_date: 2013-11-10 |
| |
| bluebook: |
| name: Project Blue Book |
| due_date: <%= 6.months.from_now %> |
While we’re at it, we’ll need two project tasks to make the sorting work. We also must add belongs_to :project in app/models/task.rb:
integration/01/gatherer/spec/fixtures/tasks.yml | |
| one: |
| project: bluebook |
| title: ... |
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.