The Days Are Action-Packed

Running the tests now gives us a different error since we’ve defined new_project_path:

 
1) adding projects allows a user to create a project with tasks
 
Failure/Error: visit new_project_path
 
AbstractController::ActionNotFound:
 
The action 'new' could not be found for ProjectsController
 
# ./spec/features/add_project_spec.rb:6:in `block (2 levels) in <top (required)>'

We need a new action in our Projects controller. Since it is not going to have logic beyond Rails boilerplate, we don’t need to test anything more than the existing Capybara test does.

test_first_rspec/01/gatherer/app/controllers/projects_controller.rb
 
class​ ProjectsController < ApplicationController
 
 
def​ new
 
@project = Project.new
 
​ ...

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.