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 trialFredrik August Madsen-Malmo
16,261 PointsUninitialised constant: TodoList::TodoItem
Hey,
I'm trying to run the rspec command after following this videos instructions. But when I run the command I get the error uninitialised constant: TodoList::TodoItem. Does anyone know how to fix this?
Thanks, Fredrik A. Madsen-Malmo
Failures:
1) Viewing todo items Displays item content when a todo list has content
Failure/Error: todo_list.todo_items.create(content: "Eggs")
NameError:
uninitialized constant TodoList::TodoItem
# ./spec/features/todo_items/index_spec.rb:26:in `block (2 levels) in <top (required)>'
EDIT: Here is the rspec itself EDIT: I'm pretty new to ruby/rails so I don't really know what you are asking for. I included some files which I thought may be important. Just comment if you want me to paste some more files.
Fredrik August Madsen-Malmo
16,261 PointsAdded it to the question Maciej Czuchnowski.
Maciej Czuchnowski
36,441 PointsThat's just the spec. But what is tested by this spec? I need that code, the answer could be hidden there.
Fredrik August Madsen-Malmo
16,261 PointsAh okay, sorry. I will add shortly
Maciej Czuchnowski
36,441 PointsAlso, which version of rspec are you using?
Maciej Czuchnowski
36,441 PointsI downloaded the app below the video and pasted your spec instead of Jason's spec and this test succeeds, so the bug has to be somewhere else.
Fredrik August Madsen-Malmo
16,261 PointsI use rspec v3.0.3
Maciej Czuchnowski
36,441 PointsI would suggest switching to 2.14, because rspec went through some changes in version 3. just change the version in Gemfile and run bundle install. Maybe this will fix something. If not - we will keep looking.
Fredrik August Madsen-Malmo
16,261 PointsThanks, will try that now. But I think I will have to revert capybara as well then. Do you know which capybarar version is used in the videos?
Maciej Czuchnowski
36,441 PointsI think it's 2.1.0, but capybara didn't go through any huge changes as far as I know. With RSpec these were even changes in syntax.
Fredrik August Madsen-Malmo
16,261 PointsThanks man, I ended up changing out my entire project with the one from the video. And it seems some of the gems are to old to be used. I get an error message saying nokogiri is missing, and when I try to install that I get an error message saying libxml2 is missing.
Maciej Czuchnowski
36,441 PointsSomeone else had the sam eproblem on the forum earlier. Lots of problems with nokogiri:
There are many reasons for that and lots of solutions.
Maciej Czuchnowski
36,441 PointsMaciej Czuchnowski
36,441 PointsCan you show the code which is tested by this spec?