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

Lindsay Williams
Lindsay Williams
2,850 Points

Failure/Error: visit "/todo_lists"

I am getting a Failure/Error: visit "/todo_lists" when attempting to run the first test

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

2 Answers

Richard McGrath
Richard McGrath
5,597 Points

In create_spec.rb remove: require 'spec_helper' and replace it with: require 'rails_helper'

require 'rails_helper'

describe 'Creating todo lists' do
  it 'redirects to the todo list index page on success' do
    visit '/todo_lists'
    click_link 'New Todo list'
    expect(page).to have_content('New todo_lists')
  end
end

Source: http://stackoverflow.com/a/15149241