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

Rob Rouland
Rob Rouland
7,435 Points

In odot project, bundle command fails when shoulda-matchers is added to Gemfile

On Ruby track, doing odot project.

I'm unable to bundle after adding gem 'shoulda-matchers' to Gemfile. bundle returns "Could not fetch specs from https://rubygems.org/

shoulda-matchers is added just under capybara in the group test do block of the Gemfile. Commenting out shoulda-matchers results in bundle succeeding.

I'm running the treehouse VM on cmdr on my win7 laptop.

Any ideas? I'm jonesing to proceed with my odot project.

3 Answers

Hey Rob!

I'm not 100% sure, but is there a version that goes along with 'shoulda-matchers' in the gem file? You may be doing something like calling a version that doesn't exist or have a typo in your gem name or syntax.

Here's the syntax for the gemfile for the latest version of shoulda-matchers, make sure you adjust the dependency version to match the video.

gem 'shoulda-matchers', '~> 2.6.1'

You could also post your gemfile, or compare against the project downloads gemfile :-)

Hope this helps!

Rob Rouland
Rob Rouland
7,435 Points

Using Rails 4.1.2, Ruby 2.0.0p353

Rob Rouland
Rob Rouland
7,435 Points

I've tried it with no version, as shown in the lecture, but it didn't bundle. Then I tried adding the latest version like you've shown and still no luck. However, I haven't tried looking over the project downloads gemfile... great suggestion! Thanks! I have a feeling that my Ruby or Rails version is possibly too high.

Rob Rouland
Rob Rouland
7,435 Points
source 'https://rubygems.org'

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]

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

group :test do
    gem 'capybara', '~>2.1.0'
    gem 'shoulda-matchers', '~> 2.6.1'
end

I live off the projects downloads haha! If you're looking for version control of Ruby + Rails check out the article below - I know you're on windows and using the treehouse VM but good for reference/finding a similar article for your OS.

http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/

If you don't know RVM already, it essentially allows you to install multiple versions of Ruby. You can assign multiple gem groups to each version of Ruby - meaning you can have an unlimited number of possibilities for ruby/rails versions, and it's quick and easy to flick between them.

The treehouse VM may have this (or a similar program 'rbenv') built in already so just double check.

Here's my gemfile from the project so far (I've tried to remove the gems which aren't relevant right now, but there might be some leftover - don't panic!)

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.0'
gem 'bcrypt-ruby','~> 3.1.2'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'foundation-rails', '~> 5.2.2'

group :development do
  gem 'spring'
  gem 'quiet_assets', '~> 1.0.2'
end

group :doc do
 gem 'sdoc', require: false
end

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

group :test do
    gem 'capybara', '~>2.1.0'
    gem 'shoulda-matchers', '~>2.6.0'
end
Rob Rouland
Rob Rouland
7,435 Points

Thanks, Tom! I think it is a problem with my Gemfile. I've downloaded the project file and I'll compare it with mine and yours and I should be able to figure this out. I'm gonna take a break and go with my brother to look at the new Corvette, so I'll probably be refreshed when I look at this tonight. Thanks!

No worries! Let me know how you get your final fix!

One really important thing I forgot to say is that I took the Upgrade to Rails 4.1 course, which is why i have

gem 'rails', '4.1.0'

I think the version you should be using at your stage is

gem 'rails', '4.0.1'
Rob Rouland
Rob Rouland
7,435 Points

Thanks for the help, Tom! This is resolved now, but I'm not really sure how. After trying a bunch of different changes to the gemfile, including using the one from the project downloads, I just couldn't get it to bundle with shoulda-matchers in the gemfile. Then I thought I'd abandon the VM and try it on my win 7 laptop. Easy to do, because git was synching files for the odot project on my laptop anyway. It worked on the laptop.

gem 'shoulda-matchers', '~>2.6.1'

Then after about a week break, I came back, fired up the VM and tried again. With the same gemfile from my laptop, the bundle command succeeded on the VM. Not sure exactly what changed, but it's working now on my laptop and on the treehouse VM.

Thanks! Hope it helps someone in the future.