aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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