From 35e56f6fa535288abf1de7fa70c2faed5e2d88ff Mon Sep 17 00:00:00 2001 From: Gaurish Sharma Date: Mon, 13 Jan 2014 16:54:06 +0530 Subject: standardize on jruby_skip & rbx_skip This Adds helpers(jruby_skip & rbx_skip). In Future, Plan is to use these helpers instead of calls directly to RUBY_ENGINE/RbConfig/JRUBY_VERSION --- actionmailer/test/abstract_unit.rb | 9 +++++++++ actionpack/test/abstract_unit.rb | 9 +++++++++ actionpack/test/dispatch/static_test.rb | 4 +--- actionview/test/abstract_unit.rb | 8 ++++++++ activesupport/test/abstract_unit.rb | 2 +- railties/test/abstract_unit.rb | 9 +++++++++ railties/test/generators/app_generator_test.rb | 4 ++-- 7 files changed, 39 insertions(+), 6 deletions(-) diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb index cf790c7487..93d16f491d 100644 --- a/actionmailer/test/abstract_unit.rb +++ b/actionmailer/test/abstract_unit.rb @@ -62,3 +62,12 @@ end def restore_delivery_method ActionMailer::Base.delivery_method = @old_delivery_method end + +# Skips the current run on Rubinius using Minitest::Assertions#skip +def rubinius_skip(message = '') + skip message if RUBY_ENGINE == 'rbx' +end +# Skips the current run on JRuby using Minitest::Assertions#skip +def jruby_skip(message = '') + skip message if defined?(JRUBY_VERSION) +end diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 37e993b4e5..03a4741f42 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -351,3 +351,12 @@ module Backoffice class ImagesController < ResourcesController; end end end + +# Skips the current run on Rubinius using Minitest::Assertions#skip +def rubinius_skip(message = '') + skip message if RUBY_ENGINE == 'rbx' +end +# Skips the current run on JRuby using Minitest::Assertions#skip +def jruby_skip(message = '') + skip message if defined?(JRUBY_VERSION) +end diff --git a/actionpack/test/dispatch/static_test.rb b/actionpack/test/dispatch/static_test.rb index d83461e52f..5bd1806b21 100644 --- a/actionpack/test/dispatch/static_test.rb +++ b/actionpack/test/dispatch/static_test.rb @@ -37,10 +37,8 @@ module StaticTests end def test_served_static_file_with_non_english_filename - if RUBY_ENGINE == 'jruby ' - skip "Stop skipping if following bug gets fixed: " \ + jruby_skip "Stop skipping if following bug gets fixed: " \ "http://jira.codehaus.org/browse/JRUBY-7192" - end assert_html "means hello in Japanese\n", get("/foo/#{Rack::Utils.escape("こんにちは.html")}") end diff --git a/actionview/test/abstract_unit.rb b/actionview/test/abstract_unit.rb index 9928da4774..9eae3a4fbd 100644 --- a/actionview/test/abstract_unit.rb +++ b/actionview/test/abstract_unit.rb @@ -331,3 +331,11 @@ module ActionDispatch end end +# Skips the current run on Rubinius using Minitest::Assertions#skip +def rubinius_skip(message = '') + skip message if RUBY_ENGINE == 'rbx' +end +# Skips the current run on JRuby using Minitest::Assertions#skip +def jruby_skip(message = '') + skip message if defined?(JRUBY_VERSION) +end diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index 1dfa3833f0..0b393e0c7a 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -34,5 +34,5 @@ end # Skips the current run on JRuby using Minitest::Assertions#skip def jruby_skip(message = '') - skip message if RUBY_ENGINE == 'jruby' + skip message if defined?(JRUBY_VERSION) end diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb index ade08d3f5a..9ccc286b4e 100644 --- a/railties/test/abstract_unit.rb +++ b/railties/test/abstract_unit.rb @@ -17,3 +17,12 @@ module TestApp secrets.secret_key_base = 'b3c631c314c0bbca50c1b2843150fe33' end end + +# Skips the current run on Rubinius using Minitest::Assertions#skip +def rubinius_skip(message = '') + skip message if RUBY_ENGINE == 'rbx' +end +# Skips the current run on JRuby using Minitest::Assertions#skip +def jruby_skip(message = '') + skip message if defined?(JRUBY_VERSION) +end diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 56b25e4d9c..8246e76607 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -458,14 +458,14 @@ class AppGeneratorTest < Rails::Generators::TestCase end def test_spring_binstubs - skip "spring doesn't run on JRuby" if defined?(JRUBY_VERSION) + jruby_skip "spring doesn't run on JRuby" generator.stubs(:bundle_command).with('install') generator.expects(:bundle_command).with('exec spring binstub --all').once quietly { generator.invoke_all } end def test_spring_no_fork - skip "spring doesn't run on JRuby" if defined?(JRUBY_VERSION) + jruby_skip "spring doesn't run on JRuby" Process.stubs(:respond_to?).with(:fork).returns(false) run_generator -- cgit v1.2.3