Rake does not work unit tests

I upgraded my application using config.gem to a Gemfile and noticed that my unit tests stopped working. This is a bit strange, and I'm not quite sure where to start looking.

When I run rake test:units --trace , I can see that my environment is being configured and lists the files that it intends to execute, but then it just returns.

It does the same if I try to run one separate file using something like: rake -I"lib:test" test/unit/foo.rb or using autotest .

Everything is very strange. As if the files are loading, but the actual unit tests are not running.

I use shoulda and fast_context , and I thought this might be a problem, but if I enable unit test using the standard def test_ syntax, it still doesn't start, so I don't think those are.

Any hints or pointers are welcome. I feel like I'm coding for the blind until I can get them to work again!


So here is where I am now:

My reasons for using bundler is to install dependencies on heroku and because I wanted to use a gem obtained from the git repository on github. Long, and especially since I removed the preinitializer for the bundle and returned to using config.gem . To get around the fact that I cannot use the github repository using config.gem , I popped my own copy in rubygems. Was it right?


Here is 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 do not know how the .gems file will be useful, because it is only a hero, and I will need to search through git for it, but here is 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 
+6
ruby-on-rails rake shoulda
source share
3 answers

You have the same problem. Just remove the hydra gem will return the normal unit test

+1
source share

You have this at the end of the config / boot.rb file:

 class Rails::Boot def run load_initializer Rails::Initializer.class_eval do def load_gems @bundler_loaded ||= Bundler.require :default, Rails.env end end Rails::Initializer.run(:set_load_path) end end 

(from http://gembundler.com/rails23.html )

0
source share

Recently, I was not able to start the specifications for the project. The reason is that I was missing a line from config / application.rb. Currently, this line appears by default when creating a new rails 3 project, but if your project was initialized a while ago, it may be missing.

 # If you have a Gemfile, require the gems listed there, including any gems # you've limited to :test, :development, or :production. Bundler.require(:default, Rails.env) if defined?(Bundler) 
0
source share

All Articles