aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/test/abstract_unit.rb8
-rw-r--r--railties/test/fcgi_dispatcher_test.rb8
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"