A Test with a View

Meanwhile, we still have this end-to-end test to wrap up. Let’s look at that test again:

test_first_rspec/04/gatherer/spec/features/add_project_spec.rb
 
require ​"rails_helper"
 
 
describe ​"adding projects"​ ​do
 
 
it ​"allows a user to create a project with tasks"​ ​do
 
visit new_project_path
 
fill_in ​"Name"​, with: ​"Project Runway"
 
fill_in ​"Tasks"​, with: ​"Task 1:3\nTask 2:5"
 
click_on(​"Create Project"​)
 
visit projects_path
 
expect(page).to have_content(​"Project Runway"​)
 
expect(page).to have_content(​"8"​)
 
end
 
 
end

So far we’ve gotten this test to pass up to the visit projects_path line. This line triggers a visit to the path /projects, which is routed to the index method of the ProjectController ...

Get Rails 4 Test Prescriptions now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.