Created
March 28, 2014 19:18
-
-
Save razielgn/9840838 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 4aaa8c5f6cf6f778cab8be43c0b72a3b3c8c5539 Mon Sep 17 00:00:00 2001 | |
From: Federico Ravasio <[email protected]> | |
Date: Fri, 28 Mar 2014 20:16:32 +0100 | |
Subject: [PATCH] Patch. | |
--- | |
Gemfile | 4 ++++ | |
actionview/test/template/render_test.rb | 2 +- | |
activerecord/test/cases/adapters/mysql/statement_pool_test.rb | 2 ++ | |
activerecord/test/cases/adapters/postgresql/statement_pool_test.rb | 2 ++ | |
activerecord/test/cases/connection_management_test.rb | 2 ++ | |
activerecord/test/cases/helper.rb | 5 +++++ | |
railties/lib/rails/test_unit/sub_test_task.rb | 7 ++----- | |
railties/lib/rails/test_unit/testing.rake | 3 ++- | |
8 files changed, 20 insertions(+), 7 deletions(-) | |
diff --git a/Gemfile b/Gemfile | |
index 4a891bf..4a52e7b 100644 | |
--- a/Gemfile | |
+++ b/Gemfile | |
@@ -90,3 +90,7 @@ end | |
# A gem necessary for ActiveRecord tests with IBM DB | |
gem 'ibm_db' if ENV['IBM_DB'] | |
+ | |
+platform :rbx do | |
+ gem 'psych' | |
+end | |
diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb | |
index ca508ab..b21c4d7 100644 | |
--- a/actionview/test/template/render_test.rb | |
+++ b/actionview/test/template/render_test.rb | |
@@ -329,7 +329,7 @@ module RenderTestCases | |
exception = assert_raises ActionView::Template::Error do | |
@controller_view.render("partial_name_local_variable") | |
end | |
- assert_match "undefined local variable or method `partial_name_local_variable'", exception.message | |
+ assert_equal :partial_name_local_variable, exception.original_exception.name | |
end | |
# TODO: The reason for this test is unclear, improve documentation | |
diff --git a/activerecord/test/cases/adapters/mysql/statement_pool_test.rb b/activerecord/test/cases/adapters/mysql/statement_pool_test.rb | |
index 209a0cf..2f5babd 100644 | |
--- a/activerecord/test/cases/adapters/mysql/statement_pool_test.rb | |
+++ b/activerecord/test/cases/adapters/mysql/statement_pool_test.rb | |
@@ -5,6 +5,8 @@ module ActiveRecord::ConnectionAdapters | |
class StatementPoolTest < ActiveRecord::TestCase | |
if Process.respond_to?(:fork) | |
def test_cache_is_per_pid | |
+ rubinius_skip 'Kernel#exit! causes the connection to be closed, breaking all the tests after this one' | |
+ | |
cache = StatementPool.new nil, 10 | |
cache['foo'] = 'bar' | |
assert_equal 'bar', cache['foo'] | |
diff --git a/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb b/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb | |
index 1497b0a..995a593 100644 | |
--- a/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb | |
+++ b/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb | |
@@ -16,6 +16,8 @@ module ActiveRecord | |
class StatementPoolTest < ActiveRecord::TestCase | |
if Process.respond_to?(:fork) | |
def test_cache_is_per_pid | |
+ rubinius_skip 'Kernel#exit! causes the connection to be closed, breaking all the tests after this one' | |
+ | |
cache = StatementPool.new nil, 10 | |
cache['foo'] = 'bar' | |
assert_equal 'bar', cache['foo'] | |
diff --git a/activerecord/test/cases/connection_management_test.rb b/activerecord/test/cases/connection_management_test.rb | |
index 77d9ae9..046550b 100644 | |
--- a/activerecord/test/cases/connection_management_test.rb | |
+++ b/activerecord/test/cases/connection_management_test.rb | |
@@ -28,6 +28,8 @@ module ActiveRecord | |
if Process.respond_to?(:fork) | |
def test_connection_pool_per_pid | |
+ rubinius_skip 'Kernel#exit! causes the connection to be closed, breaking all the tests after this one' | |
+ | |
object_id = ActiveRecord::Base.connection.object_id | |
rd, wr = IO.pipe | |
diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb | |
index 8a49dfb..501c85e 100644 | |
--- a/activerecord/test/cases/helper.rb | |
+++ b/activerecord/test/cases/helper.rb | |
@@ -189,3 +189,8 @@ module InTimeZone | |
ActiveRecord::Base.time_zone_aware_attributes = old_tz | |
end | |
end | |
+ | |
+# Skips the current run on Rubinius using Minitest::Assertions#skip | |
+def rubinius_skip(message = '') | |
+ skip message if RUBY_ENGINE == 'rbx' | |
+end | |
diff --git a/railties/lib/rails/test_unit/sub_test_task.rb b/railties/lib/rails/test_unit/sub_test_task.rb | |
index d9bffba..a575343 100644 | |
--- a/railties/lib/rails/test_unit/sub_test_task.rb | |
+++ b/railties/lib/rails/test_unit/sub_test_task.rb | |
@@ -15,9 +15,10 @@ module Rails | |
def invoke_rake_task | |
if @info.files.any? | |
create_and_run_single_test | |
- reset_application_tasks | |
+ :exit | |
else | |
Rake::Task[ENV['TEST'] ? 'test:single' : 'test:run'].invoke | |
+ :no_exit | |
end | |
end | |
@@ -30,10 +31,6 @@ module Rails | |
ENV['TESTOPTS'] ||= @info.opts | |
Rake::Task['test:single'].invoke | |
end | |
- | |
- def reset_application_tasks | |
- Rake.application.top_level_tasks.replace @info.tasks | |
- end | |
end | |
# This is a utility class used by the <tt>TestTask::TestCreator</tt> class. | |
diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake | |
index 285e2ce..afdcd6f 100644 | |
--- a/railties/lib/rails/test_unit/testing.rake | |
+++ b/railties/lib/rails/test_unit/testing.rake | |
@@ -5,7 +5,8 @@ task default: :test | |
desc 'Runs test:units, test:functionals, test:generators, test:integration together' | |
task :test do | |
- Rails::TestTask.test_creator(Rake.application.top_level_tasks).invoke_rake_task | |
+ outcome = Rails::TestTask.test_creator(Rake.application.top_level_tasks).invoke_rake_task | |
+ exit if outcome == :exit | |
end | |
namespace :test do | |
-- | |
1.8.1.2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment