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 Deleting Todo Lists

Problem with rspec

/Users/tanio/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in require': cannot load such file -- rails_helper (LoadError) from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:inblock in require' from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in load_dependency' from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:inrequire' from /Volumes/DW/Treehouse/Project1/odot/spec/models/todo_item_spec.rb:1:in <top (required)>' from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:inload' from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in block in load' from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:inload_dependency' from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in load' from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:inblock in load_spec_files' from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in each' from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:inload_spec_files' from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:97:in setup' from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:85:inrun' from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:70:in run' from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:38:ininvoke' from /Users/tanio/.rvm/gems/ruby-2.1.2/gems/rspec-core-3.0.3/exe/rspec:4:in <top (required)>' from /Users/tanio/.rvm/gems/ruby-2.1.2/bin/rspec:23:inload' from /Users/tanio/.rvm/gems/ruby-2.1.2/bin/rspec:23:in <main>' from /Users/tanio/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:ineval' from /Users/tanio/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'

Any concern?

Alexander Batalov
Alexander Batalov
21,887 Points

Gaetano Artino Please could you paste here your exact spec that fails ?

3 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

I see you are using rspec v3. While this might not help you with your current problem, I suggest using the exact versions of gems that Jason is using - rspec version 2 (this might be 2.0 or 2.14) and downgrading Rails to 4.0. I recently had problems with rspec v3 because some methods were removed since version 2 and I wasn't able to run specs based on courses like this one.

I have got a really weird issue. Some files have been corrupted and they contains strange symbols rather than code. Sorry guys I think this post is not going to be very useful for future viewers. Anyway, I solved the dependency problem just changing require 'rails_helper' with require 'spec_helper' in todo_item_spec.rb

David Gross
David Gross
19,443 Points

require': cannot load such file -- rails_helper

You need to delete the rails_helper from your spec file. Because you are using Rspec you should be using spec_helper.rb each one of your test should have require 'spec_helper' not require 'rails_helper'.

change require 'rails_helper' to require 'spec_helper'

See my comment above

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

That depends if he's using rspec 2 or 3.

The previous answers are correct and it looks like they helped the OP in this case. I will add that this (or a very similar) error will appear if you attempt to run rspec before running rails generate rspec:install.

In my case this happened when I switched gemsets :).