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 trialPascal Hausberger
16,453 PointsRSPEC undefined method 'visit' solution
Hey guys,
just wanted to post this solution for fellow learners who get this error and don't know what to do. (I couldn't find the solution for this issue for HOURS, it drove me nuts!!)
Problem: the code is exactly the same as in the Treehouse instructions/videos, however, when performing the test, it keeps saying that the methods are undefined. (when using no methods, it worked fine, though. But of course, what use is there then for a test, right? haha)
See below for the solution
Pascal Hausberger
16,453 PointsOh yeah sure! :)
2 Answers
Pascal Hausberger
16,453 PointsSolution: So apparently, when you use the newest version of RSPEC (releases September 2014), then in the create_spec.rb file, instead of
require 'spec_helper'
one should rather use
require 'rails_helper'
this worked for me. The terminal output will be much longer, but it works fine.
For more you can check: http://stackoverflow.com/questions/15148585/undefined-method-visit-when-using-rspec-and-capybara-in-rails
Hope it helps! And saves you hours of frustration! ;)
Nick Stoneman
10,093 Points+1 Pascal! And OMFG thank you, this was driving me nuts!
P.S. Treehouse, I really love that you added "Related Questions" to the lesson/video page. Maybe to build on this you can some how get posts like Pascals (that are really useful) to show up in "Related Questions". Maybe sort "Related Questions" by 'forum votes' someday?
Pascal Hausberger
16,453 Pointshaha glad i could be of help nick! :)
Brandon Barrette
20,485 PointsBrandon Barrette
20,485 PointsYou should put your solution as an "answer" so it can be marked as best for future students who may run into the same problem =) Good job on figuring it out yourself!