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

Ivan Cox
Ivan Cox
4,228 Points

Testing issues - undefined method visit

Build a Todo list application is giving me alot of problems i can't seem to get my tests to pass. After starting over just go give myself a clean slate my first test refuses to pass even with the code from the project files pasted in i keep getting Failures:

1) Creating todo lists redirects to the todo list index page on success ?[31mFailure/Error: visit "/todo_lists"?[0m ?[31mNoMethodError:?[0m ?[31m undefined method visit' for #<RSpec::ExampleGroups::CreatingTodoLists:0x25d8da0>?[0m ?[36m# ./spec/features/todo_lists/create_spec.rb:6:inblock (2 levels) in <top (required)>'?[0m

Finished in 0.002 seconds (files took 0.47832 seconds to load) ?[31m1 example, 1 failure?[0m

Failed examples:

?[31mrspec ./spec/features/todo_lists/create_spec.rb:5?[0m ?[36m# Creating todo lists redirects to the todo list index page on success?[0m

this is in my create_spec.rb file

require 'spec_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_list")
    end
end

2 Answers

Artem Prytkov
Artem Prytkov
11,932 Points

Rails can`t find visit method You need to install and setup Capybara gem to use it. Look here for details: https://github.com/jnicklas/capybara

Ivan Cox
Ivan Cox
4,228 Points

Got it working thanks for the assistance