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

Stuck on write our first tests

I'm having trouble with a no method error and I have no clue what is causing it. Any clues?

    Andys-MacBook-Pro:odot Andy$ bin/rspec spec/features/todo_lists/create_spec.rb 
    /Users/Andy/Desktop/Programs/odot/spec/spec_helper.rb:61:in `block in <top (required)>': undefined method `infer_spec_type_from_file_location!' for #    <RSpec::Core::Configuration:0x007f9eca2cf9c8> (NoMethodError)
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core.rb:120:in `configure'
    from /Users/Andy/Desktop/Programs/odot/spec/spec_helper.rb:20:in `<top (required)>'
    from /Users/Andy/Desktop/Programs/odot/spec/features/todo_lists/create_spec.rb:1:in `require'
    from /Users/Andy/Desktop/Programs/odot/spec/features/todo_lists/create_spec.rb:1:in `<top (required)>'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load_spec_files'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:22:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in `block in autorun' 

3 Answers

Do you have any deprecation warnings when you run rspec?

When I try to run it it just throws me this error.

My guess is you installed rspec 3 which had some changes.

Try

require 'rails_helper'

instead of

require 'spec_helper'

I feel like I have a lot of corrupted files because I've had a lot of errors just trying to fix this one. Is there a way to make my machine forget I ever had rails and reinstall everything from scratch, I've only been doing this about 7 months.

Can you please check if you have these lines in your Gemfile?

group :development, :test do
    gem "rspec-rails", '~> 2.0'
end

also check if you have

config.infer_spec_type_from_file_location!

line in your spec_helper.rb

I feel like I have a lot of corrupted files because I've had a lot of errors just trying to fix this one. Is there a way to make my machine forget I ever had rails and reinstall everything from scratch, I've only been doing this about 7 months.