Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Adam Short11,153 Points
Undefined methods for rspec
My code is as follows:
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
it looks identical to the teacher's, with the exception of "New Todo List" instead of "New Todo_List" (oddly, the _ isn't showing up for me).
the problem is, I keep getting errors that look like this:
Failure/Error: click_link "New Todo list"
NoMethodError: undefined method `click_link' for #<RSpec::ExampleGroups::CreatingTodoLists:0x007f9149426cb0> # ./spec/features/todo_lists/create_spec.rb:5:in `block (2 levels) in <top (required)>'
I'm not sure what is going on here? Could someone please point out my error?
Did you get this fixed? That looks like a strange error.
This almost looks as though your app doesn't understand what Capybara is doing. In
spec_helper.rb, do you have:
require 'capybara/rails' require 'capybara/rspec'
Sean Leber-FennessyFront End Web Development Techdegree Student 6,502 Points
I have the same error, here are my errors:
Failed examples: rspec ./spec/controllers/todo_lists_controller_spec.rb:135 # TodoListsController PUT update with invalid params re-renders the 'edit' template rspec ./spec/controllers/todo_lists_controller_spec.rb:127 # TodoListsController PUT update with invalid params assigns the todo_list as @todo_list rspec ./spec/controllers/todo_lists_controller_spec.rb:113 # TodoListsController PUT update with valid params assigns the requested todo_list as @todo_list rspec ./spec/controllers/todo_lists_controller_spec.rb:103 # TodoListsController PUT update with valid params updates the requested todo_list rspec ./spec/controllers/todo_lists_controller_spec.rb:57 # TodoListsController GET edit assigns the requested todo_list as @todo_list rspec ./spec/controllers/todo_lists_controller_spec.rb:92 # TodoListsController POST create with invalid params re-renders the 'new' template rspec ./spec/controllers/todo_lists_controller_spec.rb:85 # TodoListsController POST create with invalid params assigns a newly created but unsaved todo_list as @todo_list rspec ./spec/controllers/todo_lists_controller_spec.rb:72 # TodoListsController POST create with valid params assigns a newly created todo_list as @todo_list rspec ./spec/controllers/todo_lists_controller_spec.rb:42 # TodoListsController GET show assigns the requested todo_list as @todo_list rspec ./spec/controllers/todo_lists_controller_spec.rb:153 # TodoListsController DELETE destroy redirects to the todo_lists list rspec ./spec/controllers/todo_lists_controller_spec.rb:34 # TodoListsController GET index assigns all todo_lists as @todo_lists rspec ./spec/controllers/todo_lists_controller_spec.rb:50 # TodoListsController GET new assigns a new todo_list as @todo_list
I'm not sure if some of these problems are coming from different gem versions. I started the project using rails 5, with the same version of the gems listed in the project. I tried using newer gems and ran into similar errors, which is why I restarted the project and used the older gem versions hoping that would clear things up, but it's still happening.