Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
## patch for activerecord which allows running rails tests in JRuby [diff] From a96d0319871a4910f80c1cc0561fdc33206c4cdb Mon Sep 17 00:00:00 2001 From: Stephen Bannasch <stephen.bannasch@gmail.com> Date: Sat, 27 Dec 2008 15:37:47 -0500 Subject: [PATCH] initial work to get AR tests working with JRuby and jdbc --- activerecord/Rakefile | 37 ++++++++++++++----- .../test/connections/jdbc_jdbcmysql/connection.rb | 25 +++++++++++++ 2 files changed, 52 insertions(+), 10 deletions(-) create mode 100644 activerecord/test/connections/jdbc_jdbcmysql/connection.rb diff --git a/activerecord/Rakefile b/activerecord/Rakefile index f47674d..7e9012a 100644 --- a/activerecord/Rakefile +++ b/activerecord/Rakefile @@ -32,16 +32,33 @@ task :default => :test desc 'Run mysql, sqlite, and postgresql tests' task :test => %w(test_mysql test_sqlite3 test_postgresql) -for adapter in %w( mysql postgresql sqlite sqlite3 firebird db2 oracle sybase openbase frontbase ) - Rake::TestTask.new("test_#{adapter}") { |t| - t.libs << "test" << "test/connections/native_#{adapter}" - adapter_short = adapter == 'db2' ? adapter : adapter[/^[a-z]+/] - t.test_files=Dir.glob( "test/cases/**/*_test{,_#{adapter_short}}.rb" ).sort - t.verbose = true - } - - namespace adapter do - task :test => "test_#{adapter}" +JRUBY = RUBY_PLATFORM =~ /java/ && RUBY_ENGINE == "jruby" + +if JRUBY + for adapter in %w( jdbcmysql ) + Rake::TestTask.new("test_#{adapter}") { |t| + t.libs << "test" << "test/connections/jdbc_#{adapter}" + adapter_short = adapter == 'db2' ? adapter : adapter[/^[a-z]+/] + t.test_files=Dir.glob( "test/cases/**/*_test{,_#{adapter_short}}.rb" ).sort + t.verbose = true + } + + namespace adapter do + task :test => "test_#{adapter}" + end + end +else + for adapter in %w( mysql postgresql sqlite sqlite3 firebird db2 oracle sybase openbase frontbase ) + Rake::TestTask.new("test_#{adapter}") { |t| + t.libs << "test" << "test/connections/native_#{adapter}" + adapter_short = adapter == 'db2' ? adapter : adapter[/^[a-z]+/] + t.test_files=Dir.glob( "test/cases/**/*_test{,_#{adapter_short}}.rb" ).sort + t.verbose = true + } + + namespace adapter do + task :test => "test_#{adapter}" + end end end diff --git a/activerecord/test/connections/jdbc_jdbcmysql/connection.rb b/activerecord/test/connections/jdbc_jdbcmysql/connection.rb new file mode 100644 index 0000000..b05065e --- /dev/null +++ b/activerecord/test/connections/jdbc_jdbcmysql/connection.rb @@ -0,0 +1,25 @@ +print "Using MySQL via JRuby, activerecord-jdbc-adapter and activerecord-jdbcmysql-adapter\n" +require_dependency 'models/course' +require 'logger' + +ActiveRecord::Base.logger = Logger.new("debug.log") + +# GRANT ALL PRIVILEGES ON activerecord_unittest.* to 'rails'@'localhost'; +# GRANT ALL PRIVILEGES ON activerecord_unittest2.* to 'rails'@'localhost'; + +ActiveRecord::Base.configurations = { + 'arunit' => { + :adapter => 'jdbcmysql', + :username => 'rails', + :encoding => 'utf8', + :database => 'activerecord_unittest', + }, + 'arunit2' => { + :adapter => 'jdbcmysql', + :username => 'rails', + :database => 'activerecord_unittest2' + } +} + +ActiveRecord::Base.establish_connection 'arunit' +Course.establish_connection 'arunit2' -- 1.6.0.1 ## ar_tests_jruby_errors_and_failures.sh echo "\n\njruby -S rake test_jdbcmysql TEST=test/cases/adapter_test.rb\n\n" jruby -S rake test_jdbcmysql TEST=test/cases/adapter_test.rb echo "\n\njruby -S rake test_jdbcmysql TEST=test/cases/associations/has_many_through_associations_test.rb\n\n" jruby -S rake test_jdbcmysql TEST=test/cases/associations/has_many_through_associations_test.rb echo "\n\njruby -S rake test_jdbcmysql TEST=test/cases/migration_test.rb\n\n" jruby -S rake test_jdbcmysql TEST=test/cases/migration_test.rb echo "\n\njruby -S rake test_jdbcmysql TEST=test/cases/query_cache_test.rb\n\n" jruby -S rake test_jdbcmysql TEST=test/cases/query_cache_test.rb echo "\n\njruby -S rake test_jdbcmysql TEST=test/cases/schema_dumper_test.rb\n\n" jruby -S rake test_jdbcmysql TEST=test/cases/schema_dumper_test.rb echo "\n\njruby -S rake test_jdbcmysql TEST=test/cases/unconnected_test.rb\n\n" jruby -S rake test_jdbcmysql TEST=test/cases/unconnected_test.rb echo "\n\njruby -S rake test_jdbcmysql TEST=test/cases/base_test.rb\n\n" jruby -S rake test_jdbcmysql TEST=test/cases/base_test.rb ## test results [activerecord (ar-jdbc)]$ sh ~/Desktop/ar_tests_jruby_errors_and_failures.sh jruby -S rake test_jdbcmysql TEST=test/cases/adapter_test.rb (in /Users/stephen/dev/ruby/src/gems/rails.git/activerecord) /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009. /Users/stephen/dev/ruby/src/jruby.git/bin/jruby -Ilib:test:test/connections/jdbc_jdbcmysql "/Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/cases/adapter_test.rb" Using MySQL via JRuby, activerecord-jdbc-adapter and activerecord-jdbcmysql-adapter ActiveRecord::ConnectionAdapters::JdbcAdapter::Version::VERSION Loaded suite /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader Started FF..... Finished in 0.408968 seconds. 1) Failure: test_add_limit_offset_should_sanitize_sql_injection_for_limit_with_comas(AdapterTest) [test/cases/adapter_test.rb:129:in `test_add_limit_offset_should_sanitize_sql_injection_for_limit_with_comas' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run']: <" LIMIT 1,7"> expected but was <" LIMIT 1, 7 procedure help()">. 2) Failure: test_add_limit_offset_should_sanitize_sql_injection_for_limit_without_comas(AdapterTest) [test/cases/adapter_test.rb:115:in `test_add_limit_offset_should_sanitize_sql_injection_for_limit_without_comas' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run']: <" LIMIT 1"> expected but was <" LIMIT 1 select * from schema">. 7 tests, 17 assertions, 2 failures, 0 errors rake aborted! Command failed with status (1): [/Users/stephen/dev/ruby/src/jruby.git/bin/...] (See full trace by running task with --trace) jruby -S rake test_jdbcmysql TEST=test/cases/associations/has_many_through_associations_test.rb (in /Users/stephen/dev/ruby/src/gems/rails.git/activerecord) /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009. /Users/stephen/dev/ruby/src/jruby.git/bin/jruby -Ilib:test:test/connections/jdbc_jdbcmysql "/Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/cases/associations/has_many_through_associations_test.rb" Using MySQL via JRuby, activerecord-jdbc-adapter and activerecord-jdbcmysql-adapter ActiveRecord::ConnectionAdapters::JdbcAdapter::Version::VERSION Loaded suite /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader Started .................E. Finished in 1.58491 seconds. 1) Error: test_inner_join_with_quoted_table_name(HasManyThroughAssociationsTest): NameError: uninitialized constant Person::Reference ./test/cases/../../../activesupport/lib/active_support/dependencies.rb:102:in `const_missing' ./test/cases/../../lib/active_record/base.rb:2167:in `class_eval' ./test/cases/../../lib/active_record/base.rb:2167:in `compute_type' ./test/cases/../../../activesupport/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings' ./test/cases/../../lib/active_record/base.rb:2163:in `compute_type' ./test/cases/../../lib/active_record/reflection.rb:151:in `klass' ./test/cases/../../lib/active_record/reflection.rb:244:in `source_reflection' ./test/cases/../../lib/active_record/reflection.rb:244:in `collect' ./test/cases/../../lib/active_record/reflection.rb:244:in `source_reflection' ./test/cases/../../lib/active_record/reflection.rb:275:in `check_validity!' ./test/cases/../../lib/active_record/associations/has_many_through_association.rb:5:in `initialize' ./test/cases/../../lib/active_record/associations.rb:1303:in `jobs' test/cases/associations/has_many_through_associations_test.rb:208:in `test_inner_join_with_quoted_table_name' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run' 19 tests, 60 assertions, 0 failures, 1 errors rake aborted! Command failed with status (1): [/Users/stephen/dev/ruby/src/jruby.git/bin/...] (See full trace by running task with --trace) jruby -S rake test_jdbcmysql TEST=test/cases/migration_test.rb (in /Users/stephen/dev/ruby/src/gems/rails.git/activerecord) /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009. /Users/stephen/dev/ruby/src/jruby.git/bin/jruby -Ilib:test:test/connections/jdbc_jdbcmysql "/Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/cases/migration_test.rb" Using MySQL via JRuby, activerecord-jdbc-adapter and activerecord-jdbcmysql-adapter ActiveRecord::ConnectionAdapters::JdbcAdapter::Version::VERSION Loaded suite /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader Started ........F...................................E.........F......................E...F.......... Finished in 8.935638 seconds. 1) Failure: test_integer_creates_integer_column(ChangeTableMigrationsTest) [(eval):16:in `integer' (eval):5:in `each' (eval):5:in `integer' test/cases/migration_test.rb:1380:in `test_integer_creates_integer_column' test/cases/migration_test.rb:1472:in `with_change_table' ./test/cases/../../lib/active_record/connection_adapters/abstract/schema_statements.rb:175:in `change_table' test/cases/migration_test.rb:1471:in `with_change_table' test/cases/migration_test.rb:1377:in `test_integer_creates_integer_column' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run']: unexpected invocation: #<ActiveRecord::ConnectionAdapters::JdbcAdapter:0x1100>.add_column(:delete_me, :foo, 'integer(10)', {}) unsatisfied expectations: - expected exactly once, not yet invoked: #<ActiveRecord::ConnectionAdapters::JdbcAdapter:0x1100>.add_column(:delete_me, :bar, 'integer', {}) - expected exactly once, not yet invoked: #<ActiveRecord::ConnectionAdapters::JdbcAdapter:0x1100>.add_column(:delete_me, :foo, 'integer', {}) 2) Error: test_create_table_with_defaults(MigrationTest): ActiveRecord::StatementInvalid: ActiveRecord::ActiveRecordError: BLOB/TEXT column 'five' can't have a default value: CREATE TABLE `testings` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `one` varchar(255) DEFAULT 'hello', `two` tinyint(1) DEFAULT 1, `three` tinyint(1) DEFAULT 0, `four` integer(10) DEFAULT 1, `five` text DEFAULT 'hello') ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin ./test/cases/../../lib/active_record/connection_adapters/abstract_adapter.rb:189:in `log' /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9/lib/active_record/connection_adapters/jdbc_adapter.rb:581:in `execute' ./test/cases/helper.rb:42:in `execute_with_query_record' ./test/cases/../../lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `create_table' /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9/lib/jdbc_adapter/jdbc_mysql.rb:173:in `create_table' test/cases/migration_test.rb:125:in `test_create_table_with_defaults' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run' 3) Failure: test_keeping_default_and_notnull_constaint_on_change(MigrationTest) [test/cases/migration_test.rb:753:in `test_keeping_default_and_notnull_constaint_on_change' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run']: <false> expected but was <true>. 4) Error: test_rename_column_preserves_default_value_not_null(MigrationTest): NoMethodError: undefined method `[]' for nil:NilClass /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9/lib/jdbc_adapter/jdbc_mysql.rb:202:in `rename_column' test/cases/migration_test.rb:536:in `test_rename_column_preserves_default_value_not_null' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run' 5) Failure: test_rename_nonexistent_column(MigrationTest) [test/cases/migration_test.rb:550:in `test_rename_nonexistent_column' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run']: <ActiveRecord::ActiveRecordError> exception expected but was Class: <NoMethodError> Message: <"undefined method `[]' for nil:NilClass"> ---Backtrace--- /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9/lib/jdbc_adapter/jdbc_mysql.rb:202:in `rename_column' test/cases/migration_test.rb:551:in `test_rename_nonexistent_column' test/cases/migration_test.rb:550:in `test_rename_nonexistent_column' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run' --------------- 92 tests, 230 assertions, 3 failures, 2 errors rake aborted! Command failed with status (1): [/Users/stephen/dev/ruby/src/jruby.git/bin/...] (See full trace by running task with --trace) jruby -S rake test_jdbcmysql TEST=test/cases/query_cache_test.rb (in /Users/stephen/dev/ruby/src/gems/rails.git/activerecord) /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009. /Users/stephen/dev/ruby/src/jruby.git/bin/jruby -Ilib:test:test/connections/jdbc_jdbcmysql "/Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/cases/query_cache_test.rb" Using MySQL via JRuby, activerecord-jdbc-adapter and activerecord-jdbcmysql-adapter ActiveRecord::ConnectionAdapters::JdbcAdapter::Version::VERSION Loaded suite /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader Started ........F... Finished in 0.782492 seconds. 1) Failure: test_count_queries_with_cache(QueryCacheTest) [./test/cases/../../lib/active_record/test_case.rb:30:in `assert_queries' test/cases/query_cache_test.rb:25:in `test_count_queries_with_cache' ./test/cases/../../lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache' ./test/cases/../../lib/active_record/query_cache.rb:9:in `cache' test/cases/query_cache_test.rb:24:in `test_count_queries_with_cache' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run']: 2 instead of 1 queries were executed. Queries: SELECT count(*) AS count_all FROM `tasks` SELECT count(*) AS count_all FROM `tasks` . <1> expected but was <2>. 12 tests, 20 assertions, 1 failures, 0 errors rake aborted! Command failed with status (1): [/Users/stephen/dev/ruby/src/jruby.git/bin/...] (See full trace by running task with --trace) jruby -S rake test_jdbcmysql TEST=test/cases/schema_dumper_test.rb (in /Users/stephen/dev/ruby/src/gems/rails.git/activerecord) /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009. /Users/stephen/dev/ruby/src/jruby.git/bin/jruby -Ilib:test:test/connections/jdbc_jdbcmysql "/Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/cases/schema_dumper_test.rb" Using MySQL via JRuby, activerecord-jdbc-adapter and activerecord-jdbcmysql-adapter ActiveRecord::ConnectionAdapters::JdbcAdapter::Version::VERSION Loaded suite /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader Started ......F.... Finished in 5.939464 seconds. 1) Failure: test_schema_dump_includes_limit_constraint_for_integer_columns(SchemaDumperTest) [test/cases/schema_dumper_test.rb:113:in `test_schema_dump_includes_limit_constraint_for_integer_columns' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run']: <"# This file is auto-generated from the current state of the database. Instead of editing this file, \n# please use the migrations feature of Active Record to incrementally modify your database, and\n# then regenerate this schema definition.\n#\n# Note that this schema.rb definition is the authoritative source for your database schema. If you need\n# to create the application database on another system, you should be using db:schema:load, not running\n# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations\n# you'll amass, the slower it'll run and the greater likelihood for issues).\n#\n# It's strongly recommended to check this file into your version control system.\n\nActiveRecord::Schema.define(:version => 0) do\n\n create_table \"integer_limits\", :force => true do |t|\n t.integer \"c_int_without_limit\"\n t.integer \"c_int_1\", :limit => 1\n t.integer \"c_int_2\", :limit => 2\n t.integer \"c_int_3\", :limit => 3\n t.integer \"c_int_4\", :limit => 4\n t.integer \"c_int_5\", :limit => 5\n t.integer \"c_int_6\", :limit => 6\n t.integer \"c_int_7\", :limit => 7\n t.integer \"c_int_8\", :limit => 8\n end\n\nend\n"> expected to be =~ </c_int_5.*:limit => 8/>. 11 tests, 325 assertions, 1 failures, 0 errors rake aborted! Command failed with status (1): [/Users/stephen/dev/ruby/src/jruby.git/bin/...] (See full trace by running task with --trace) jruby -S rake test_jdbcmysql TEST=test/cases/unconnected_test.rb (in /Users/stephen/dev/ruby/src/gems/rails.git/activerecord) /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009. /Users/stephen/dev/ruby/src/jruby.git/bin/jruby -Ilib:test:test/connections/jdbc_jdbcmysql "/Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/cases/unconnected_test.rb" Using MySQL via JRuby, activerecord-jdbc-adapter and activerecord-jdbcmysql-adapter ActiveRecord::ConnectionAdapters::JdbcAdapter::Version::VERSION Loaded suite /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader Started .F Finished in 0.125912 seconds. 1) Failure: test_underlying_adapter_no_longer_active(TestUnconnectedAdapter) [test/cases/unconnected_test.rb:30:in `test_underlying_adapter_no_longer_active' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run']: Removed adapter should no longer be active. <false> is not true. 2 tests, 3 assertions, 1 failures, 0 errors rake aborted! Command failed with status (1): [/Users/stephen/dev/ruby/src/jruby.git/bin/...] (See full trace by running task with --trace) jruby -S rake test_jdbcmysql TEST=test/cases/base_test.rb (in /Users/stephen/dev/ruby/src/gems/rails.git/activerecord) /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009. /Users/stephen/dev/ruby/src/jruby.git/bin/jruby -Ilib:test:test/connections/jdbc_jdbcmysql "/Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/cases/base_test.rb" Using MySQL via JRuby, activerecord-jdbc-adapter and activerecord-jdbcmysql-adapter ActiveRecord::ConnectionAdapters::JdbcAdapter::Version::VERSION Loaded suite /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader Started ...............................................................................................................................F......................................F...F.......F............ Finished in 4.514707 seconds. 1) Failure: test_read_attributes_before_type_cast_on_datetime(BasicsTest) [test/cases/base_test.rb:148:in `test_read_attributes_before_type_cast_on_datetime' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run']: <"2008-12-31 15:01:28"> expected but was <"2008-12-31 15:01:28.0">. 2) Failure: test_to_xml_including_methods(BasicsTest) [test/cases/base_test.rb:1969:in `test_to_xml_including_methods' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run']: <false> is not true. 3) Failure: test_to_xml_with_block(BasicsTest) [test/cases/base_test.rb:1978:in `test_to_xml_with_block' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run']: <false> is not true. 4) Failure: test_update_all_with_order_and_limit_updates_subset_only(BasicsTest) [test/cases/base_test.rb:686:in `test_update_all_with_order_and_limit_updates_subset_only' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run']: Exception raised: Class: <ActiveRecord::StatementInvalid> Message: <"ActiveRecord::ActiveRecordError: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery': UPDATE `posts` SET body = 'bulk update!' WHERE `id` IN (SELECT `id` FROM `posts` WHERE (`posts`.author_id = 1) ORDER BY posts.id LIMIT 1)"> ---Backtrace--- ./test/cases/../../lib/active_record/connection_adapters/abstract_adapter.rb:189:in `log' /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9/lib/active_record/connection_adapters/jdbc_adapter.rb:581:in `execute' ./test/cases/helper.rb:42:in `execute_with_query_record' /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9/lib/active_record/connection_adapters/jdbc_adapter.rb:600:in `jdbc_update' ./test/cases/../../lib/active_record/connection_adapters/abstract/query_cache.rb:25:in `update_with_query_dirty' ./test/cases/../../lib/active_record/base.rb:849:in `update_all' ./test/cases/../../lib/active_record/associations/association_collection.rb:374:in `method_missing' ./test/cases/../../lib/active_record/base.rb:2111:in `with_scope' ./test/cases/../../lib/active_record/associations/association_proxy.rb:206:in `with_scope' ./test/cases/../../lib/active_record/associations/association_collection.rb:370:in `method_missing' test/cases/base_test.rb:689:in `test_update_all_with_order_and_limit_updates_subset_only' test/cases/base_test.rb:686:in `test_update_all_with_order_and_limit_updates_subset_only' ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:57:in `run' --------------- 191 tests, 559 assertions, 4 failures, 0 errors rake aborted! Command failed with status (1): [/Users/stephen/dev/ruby/src/jruby.git/bin/...] (See full trace by running task with --trace) [activerecord (ar-jdbc)]$
This paste will be private.
From the Design Piracy series on my blog: