diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-02-16 15:12:28 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-02-16 15:12:28 -0600 |
commit | c33ab118f8207f2fe6226a01587ee1e950055873 (patch) | |
tree | 7db8069a6ac3de68db277380293a4e51726b96e6 /railties | |
parent | 460269dcafd6d190d51176b2b03e65f3f44669b8 (diff) | |
download | rails-c33ab118f8207f2fe6226a01587ee1e950055873.tar.gz rails-c33ab118f8207f2fe6226a01587ee1e950055873.tar.bz2 rails-c33ab118f8207f2fe6226a01587ee1e950055873.zip |
Properly skip fcgi tests if the gem is not installed
Diffstat (limited to 'railties')
-rw-r--r-- | railties/test/abstract_unit.rb | 8 | ||||
-rw-r--r-- | railties/test/fcgi_dispatcher_test.rb | 8 |
2 files changed, 11 insertions, 5 deletions
diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb index 43736ee7ec..a950fc8b7e 100644 --- a/railties/test/abstract_unit.rb +++ b/railties/test/abstract_unit.rb @@ -18,3 +18,11 @@ if defined?(RAILS_ROOT) else RAILS_ROOT = File.dirname(__FILE__) end + +def uses_gem(gem_name, test_name, version = '> 0') + gem gem_name.to_s, version + require gem_name.to_s + yield +rescue LoadError + $stderr.puts "Skipping #{test_name} tests. `gem install #{gem_name}` and try again." +end diff --git a/railties/test/fcgi_dispatcher_test.rb b/railties/test/fcgi_dispatcher_test.rb index 805c4f3a60..c7a7f77118 100644 --- a/railties/test/fcgi_dispatcher_test.rb +++ b/railties/test/fcgi_dispatcher_test.rb @@ -1,6 +1,7 @@ require 'abstract_unit' -begin +uses_gem "fcgi", "0.8.7" do + require 'action_controller' require 'fcgi_handler' @@ -260,7 +261,4 @@ class RailsFCGIHandlerPeriodicGCTest < Test::Unit::TestCase assert_nil @handler.when_ready end end - -rescue LoadError => e - raise unless e.message =~ /fcgi/ -end +end # uses_gem "fcgi" |