aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-10-18 12:04:51 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-10-18 12:04:51 -0700
commit4f106bbb2ccbcfb54865bdca786b9fb0ee669032 (patch)
tree3e08a545264b32c21810d4f54c5161b11ee9d28e /activesupport
parent11acaa172c73c5d1787184ef5545df358027462c (diff)
downloadrails-4f106bbb2ccbcfb54865bdca786b9fb0ee669032.tar.gz
rails-4f106bbb2ccbcfb54865bdca786b9fb0ee669032.tar.bz2
rails-4f106bbb2ccbcfb54865bdca786b9fb0ee669032.zip
some ruby interpreters don't have ruby-prof so just skip the tests
rather than exiting the process.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/testing/performance/ruby.rb2
-rw-r--r--activesupport/test/testing/performance_test.rb15
2 files changed, 13 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/testing/performance/ruby.rb b/activesupport/lib/active_support/testing/performance/ruby.rb
index 12aef0d7fe..7c149df1e4 100644
--- a/activesupport/lib/active_support/testing/performance/ruby.rb
+++ b/activesupport/lib/active_support/testing/performance/ruby.rb
@@ -2,7 +2,7 @@ begin
require 'ruby-prof'
rescue LoadError
$stderr.puts 'Specify ruby-prof as application\'s dependency in Gemfile to run benchmarks.'
- exit
+ raise
end
module ActiveSupport
diff --git a/activesupport/test/testing/performance_test.rb b/activesupport/test/testing/performance_test.rb
index 53073cb8db..6918110cce 100644
--- a/activesupport/test/testing/performance_test.rb
+++ b/activesupport/test/testing/performance_test.rb
@@ -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 @@ module ActiveSupport
end
end
end
-end \ No newline at end of file
+end