O'Reilly logo

Rails 4 Test Prescriptions by Noel Rappin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required