I've upgraded my app from using config.gem
to a Gemfile
with bundler and have noticed that my unit tests have now stopped running. It's a bit strange and I'm not entirely sure where to start looking.
When I run rake test:units --trace
I can see my environment being setup and it lists the files it intends to execute, but then it just returns.
It does the same thing if I try to run one individual file using something like: rake -I"lib:test" test/unit/foo.rb
or using autotest
.
It's all very strange. It's as if the files are being loaded but the actual unit tests are not being run.
I'm using shoulda
and fast_context
and I thought these might be the problem but if I include a unit test using the standard def test_
syntax it still doesn't get run so I don't think it's those.
Any hints or pointers would be greatly appreciated. I feel like I'm coding blind until I can get them working again!
So here's where I am now:
My reasons for using bundler are for installing dependencies on heroku and because I wanted to use a gem sourced from a git repo on github. The long and the short of it is that I've removed the preinitializer
for bundler and have gone back to using config.gem
. To get around the fact that I can't use a github repo using config.gem
I've pushed out my own copy to rubygems. Was this the right move?
Here's the preinitializer.rb
begin
require "rubygems"
require "bundler"
rescue LoadError
raise "Could not load the bundler gem. Install it with `gem install bundler`."
end
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
"Run `gem install bundler` to upgrade."
end
begin
# Set up load paths for all bundled gems
ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
Bundler.setup
rescue Bundler::GemNotFound
raise RuntimeError, "Bundler couldn't find some gems." +
"Did you run `bundle install`?"
end
I don't know how the .gems file would be useful because it's a heroku only thing and I'd have to hunt through git for it, but here's my gemfile.
source :gemcutter
gem 'rails', '2.3.9'
gem 'pg'
gem 'minitest'
gem 'RedCloth'
gem 'erubis'
#gem 'memcached'
gem 'daemons'
gem 'resque'
gem 'inherited_resources', '1.0.6'
gem 'clearance', '0.8.8'
gem 'acl9'
gem 'sprockets'
gem 'aws-s3'
gem 'paperclip', '2.3.1.1'
gem 'rmagick', '2.12.2'
gem 'jonnii-cheddargetter', '0.1.3'
gem 'attribute_normalizer'
gem 'formtastic', '1.1.0.beta'
gem 'will_paginate', '2.3.14'
gem 'hoptoad_notifier'
gem 'mixpanel_client'
gem 'sunspot'
gem 'websolr-sunspot_rails'
gem 'geokit'
gem 'ri_cal'
gem 'jonnii-yelp'
group :development, :test do
gem 'test-spec'
gem 'shoulda'
gem 'redgreen'
gem 'factory_girl'
gem 'populator'
gem 'faker'
gem 'ZenTest'
gem 'autotest-rails'
gem 'webrat'
gem 'cucumber'
gem 'cucumber-rails'
gem 'database_cleaner'
gem 'parallel'
gem 'hydra'
gem 'heroku'
gem 'taps'
gem 'ruby-prof'
gem 'treetop'
gem 'rspec'
gem 'rspec-rails'
end