Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Write Our First Tests

undefined method `visit' for RSpec

Failures:

1) Creating todo lists redirects to the todo list index page on success Failure/Error: visit "/todo_lists"

 NoMethodError:
   undefined method `visit' for #<RSpec::ExampleGroups::CreatingTodoLists:0xb9ef8d14>
 # ./spec/features/todo_lists/create_spec.rb:5:in `block (2 levels) in <top (required)>'

Finished in 0.00106 seconds (files took 0.14891 seconds to load) 1 example, 1 failure

Failed examples:

rspec ./spec/features/todo_lists/create_spec.rb:4 # Creating todo lists redirects to the todo list index page on success

Seth Kroger
Seth Kroger
56,413 Points

Can you post your sources? (the create_spec.rb and spec_helper.rb files) Were there any errors when you tried to install Capybara?

1 Answer

Brent Forwood
Brent Forwood
18,999 Points

I had the same problem. I added

require 'rails_helper'

in create_spec.rb and it worked for me. Here's a link:

http://stackoverflow.com/questions/15148585/undefined-method-visit-when-using-rspec-and-capybara-in-rails