0

I installed postgres using homebrew and it worked fine - but now rspec won't run my tests and is throwing this error:

Could not find pg-0.16.0 in any of the sources (Bundler::GemNotFound)

the relevant part of my 'gemfile'

group :production do
  gem 'pg'
end

group :development, :test do
  gem 'sqlite3'
end

Obviously I want to get this working, but to be honest I'm more confused by why this is throwing an error in the first place. Rspec is in my test/development environment, and postgres is only in production - so why does Rspec care (or even know!) about postgres?

dax
  • 10,779
  • 8
  • 51
  • 86
  • try it http://stackoverflow.com/questions/15802774/could-not-find-pg-0-12-2-in-any-of-the-sources-when-running-rspec – shrikant1712 Aug 03 '13 at 11:56
  • You could fix this problem and avoid a lot of other problems if you developed, tested, and deployed with the same database. There are differences between databases that no ORM can insulate you from. Yes, SQLite is the default with Rails but that's a dumb default and the Rails people should be ashamed of that decision. – mu is too short Aug 03 '13 at 16:59
  • @muistooshort, agreed. I was attempting to use a different database just for production to push to heroku, but it was a dumb move. Will stick with sqlite for the moment and switch to MySQL a bit further down the road. – dax Aug 07 '13 at 07:15

1 Answers1

1

Bundler looks at all the gems in the Gemfile whenever it is run, so invalid gem names or versions will result in an error no matter what environment they are specified for. See "FAQ: Why Is Bundler Downloading Gems From --without Groups?" at http://bundler.io/rationale.html for rationale.

Peter Alfvin
  • 28,599
  • 8
  • 68
  • 106