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

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

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