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

Using the Time Data

With the task tests passing, it’s time to switch our attention back to the Project test. We need to make a slight tweak to our project_with_data_test setup so that we have tasks that are in and out of the three-week velocity window:

basics_rspec/07/gatherer/spec/models/project_spec.rb
 
let(:project) { Project.new }
 
let(:newly_done) { Task.new(size: 3, completed_at: 1.day.ago) }
 
let(:old_done) { Task.new(size: 2, completed_at: 6.months.ago) }
 
let(:small_not_done) { Task.new(size: 1) }
 
let(:large_not_done) { Task.new(size: 4) }
 
 
before(:example) ​do
 
project.tasks = [newly_done, old_done, small_not_done, large_not_done]
 
end

We’ve added one more completed task, and we’re using the ability to pass a completed date to ...

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