Permalink
Browse files

some ruby interpreters don't have ruby-prof so just skip the tests

rather than exiting the process.
  • Loading branch information...
1 parent 11acaa1 commit 4f106bbb2ccbcfb54865bdca786b9fb0ee669032 @tenderlove tenderlove committed Oct 18, 2012
@@ -2,7 +2,7 @@
require 'ruby-prof'
rescue LoadError
$stderr.puts 'Specify ruby-prof as application\'s dependency in Gemfile to run benchmarks.'
- exit
+ raise
end
module ActiveSupport
@@ -1,10 +1,19 @@
require 'abstract_unit'
-require 'active_support/testing/performance'
-
module ActiveSupport
module Testing
class PerformanceTest < ActiveSupport::TestCase
+ begin
+ require 'active_support/testing/performance'
+ HAVE_RUBYPROF = true
+ rescue LoadError
+ HAVE_RUBYPROF = false
+ end
+
+ def setup
+ skip "no rubyprof" unless HAVE_RUBYPROF
+ end
+
def test_amount_format
amount_metric = ActiveSupport::Testing::Performance::Metrics[:amount].new
assert_equal "0", amount_metric.format(0)
@@ -56,4 +65,4 @@ def test_environment_format_with_rails
end
end
end
-end
+end

0 comments on commit 4f106bb

Please sign in to comment.