From 75f8ac6ea71e4b2337f870b91ac05df98f33a8d2 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Mon, 26 Jul 2010 14:06:14 +0200 Subject: Implemented ActiveRecord::Migrations#copy based on James Adam's idea ActiveRecord::Migration#copy allows to copy migrations from one place to another, changing migrations versions and adding scope to filename. For example: ActiveRecord::Migration.copy("db/migrate", :blog_engine => "vendor/gems/blog/db/migrate") will copy all migrations from vendor/gems/blog/db/migrate to db/migrate with such format: Versions of copied migrations will be reversioned to be appended after migrations that already exists in db/migrate --- activerecord/test/cases/helper.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 1fb59d3589..4bf3c25d28 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -83,3 +83,21 @@ begin ensure $stdout = original_stdout end + +class << Time + unless method_defined? :now_before_time_travel + alias_method :now_before_time_travel, :now + end + + def now + (@now ||= nil) || now_before_time_travel + end + + def travel_to(time, &block) + @now = time + block.call + ensure + @now = nil + end +end + -- cgit v1.2.3 From ae24ce52aec97f4fc11508a3c3edf98d35f028c1 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Mon, 20 Sep 2010 16:15:18 -0300 Subject: Move helper methods to helper.rb. Make test not depend on local TZ to pass or fail. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activerecord/test/cases/helper.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 4bf3c25d28..561bb22785 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -31,6 +31,20 @@ def current_adapter?(*types) end end +def with_env_tz(new_tz = 'US/Eastern') + old_tz, ENV['TZ'] = ENV['TZ'], new_tz + yield +ensure + old_tz ? ENV['TZ'] = old_tz : ENV.delete('TZ') +end + +def with_active_record_default_timezone(zone) + old_zone, ActiveRecord::Base.default_timezone = ActiveRecord::Base.default_timezone, zone + yield +ensure + ActiveRecord::Base.default_timezone = old_zone +end + ActiveRecord::Base.connection.class.class_eval do IGNORED_SQL = [/^PRAGMA/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/, /SHOW FIELDS/] -- cgit v1.2.3 From 96bd936b64ae06d4c38e8de862521e22d7c809b9 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 21 Sep 2010 13:53:21 -0700 Subject: providing arel with column information when possible [#5392 state:resolved] --- activerecord/test/cases/helper.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 561bb22785..19a8a97c1a 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -57,6 +57,15 @@ ActiveRecord::Base.connection.class.class_eval do alias_method_chain :execute, :query_record end +ActiveRecord::Base.connection.extend Module.new { + attr_accessor :column_calls + def columns(*args) + @column_calls += 1 + super + end +} +ActiveRecord::Base.connection.column_calls = 0 + unless ENV['FIXTURE_DEBUG'] module ActiveRecord::TestFixtures::ClassMethods def try_to_load_dependency_with_silence(*args) -- cgit v1.2.3 From b7e4a97ab54f914bc464d9b3c7d8e579dd402771 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 21 Sep 2010 14:42:28 -0700 Subject: fixing tests. woo --- activerecord/test/cases/helper.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 19a8a97c1a..2d3047c875 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -57,14 +57,17 @@ ActiveRecord::Base.connection.class.class_eval do alias_method_chain :execute, :query_record end -ActiveRecord::Base.connection.extend Module.new { +ActiveRecord::Base.connection.class.class_eval { attr_accessor :column_calls - def columns(*args) + + def columns_with_calls(*args) + @column_calls ||= 0 @column_calls += 1 - super + columns_without_calls(*args) end + + alias_method_chain :columns, :calls } -ActiveRecord::Base.connection.column_calls = 0 unless ENV['FIXTURE_DEBUG'] module ActiveRecord::TestFixtures::ClassMethods -- cgit v1.2.3 From cc468d3ec81d6f1298fca91c0549584b36dafcc6 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 12 Oct 2010 15:57:26 -0700 Subject: exec returns an AR::Result --- activerecord/test/cases/helper.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 2d3047c875..f6ef155d66 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -55,6 +55,14 @@ ActiveRecord::Base.connection.class.class_eval do end alias_method_chain :execute, :query_record + + def exec_with_query_record(sql, name = nil, binds = [], &block) + $queries_executed ||= [] + $queries_executed << sql unless IGNORED_SQL.any? { |r| sql =~ r } + exec_without_query_record(sql, name, binds, &block) + end + + alias_method_chain :exec, :query_record end ActiveRecord::Base.connection.class.class_eval { -- cgit v1.2.3 From fa4686243cb4850297c865f3e1de56e790ebc0ec Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 3 Nov 2010 14:57:52 -0700 Subject: ignoring certain SQL when using Oracle --- activerecord/test/cases/helper.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index f6ef155d66..8b0f3a739d 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -48,6 +48,10 @@ end ActiveRecord::Base.connection.class.class_eval do IGNORED_SQL = [/^PRAGMA/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/, /SHOW FIELDS/] + # FIXME: this needs to be refactored so specific database can add their own + # ignored SQL. This ignored SQL is for Oracle. + IGNORED_SQL.concat [/^select .*nextval/i, /^SAVEPOINT/, /^ROLLBACK TO/, /^\s*select .* from ((all|user)_tab_columns|(all|user)_triggers|(all|user)_constraints)/im] + def execute_with_query_record(sql, name = nil, &block) $queries_executed ||= [] $queries_executed << sql unless IGNORED_SQL.any? { |r| sql =~ r } -- cgit v1.2.3 From 9a08517c8dad9824bc24c1c9874343d3d70b5360 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 5 Nov 2010 10:08:38 -0700 Subject: converted exec to exec_query for sqlite --- activerecord/test/cases/helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 8b0f3a739d..52f26b71f5 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -60,13 +60,13 @@ ActiveRecord::Base.connection.class.class_eval do alias_method_chain :execute, :query_record - def exec_with_query_record(sql, name = nil, binds = [], &block) + def exec_query_with_query_record(sql, name = nil, binds = [], &block) $queries_executed ||= [] $queries_executed << sql unless IGNORED_SQL.any? { |r| sql =~ r } - exec_without_query_record(sql, name, binds, &block) + exec_query_without_query_record(sql, name, binds, &block) end - alias_method_chain :exec, :query_record + alias_method_chain :exec_query, :query_record end ActiveRecord::Base.connection.class.class_eval { -- cgit v1.2.3 From ce66bfdc54e3c1a4a726ebbdd3207f327d4297cf Mon Sep 17 00:00:00 2001 From: Marcin Raczkowski Date: Sat, 28 Aug 2010 18:57:50 +0200 Subject: IdentityMap - misc fixes - Added IdentityMap to be included into AR::Base - Fixed bug with Mysql namespace missing when running tests only for sqlite - Added sqlite as default connection --- activerecord/test/cases/helper.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 52f26b71f5..d80e2734ce 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -11,7 +11,14 @@ require 'mocha' require 'active_record' require 'active_support/dependencies' -require 'connection' +begin + require 'connection' +rescue LoadError + # If we cannot load connection we assume that driver was not loaded for this test case, so we load sqlite3 as default one. + # This allows for running separate test cases by simply running test file. + connection_type = defined?(JRUBY_VERSION) ? 'jdbc' : 'native' + require "test/connections/#{connection_type}_sqlite3/connection" +end begin require 'ruby-debug' -- cgit v1.2.3 From 6d58b274222ddd917939998761f75e3d87756a3e Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 21 Sep 2010 19:48:57 -0300 Subject: Set Identity Map disabled by default. Enable it for testing. --- activerecord/test/cases/helper.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index d80e2734ce..7db55da02a 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -31,6 +31,9 @@ ActiveSupport::Deprecation.debug = true # Quote "type" if it's a reserved word for the current connection. QUOTED_TYPE = ActiveRecord::Base.connection.quote_column_name('type') +# Enable Identity Map for testing +ActiveRecord::IdentityMap.enabled = true + def current_adapter?(*types) types.any? do |type| ActiveRecord::ConnectionAdapters.const_defined?(type) && -- cgit v1.2.3 From 938243feb9ea177b84276821818c9eed66064340 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 19 Nov 2010 16:26:09 -0800 Subject: do not require ruby-debug automatically. please require it if you have declared it as a dependency --- activerecord/test/cases/helper.rb | 5 ----- 1 file changed, 5 deletions(-) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 52f26b71f5..f9bbc5299b 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -13,11 +13,6 @@ require 'active_record' require 'active_support/dependencies' require 'connection' -begin - require 'ruby-debug' -rescue LoadError -end - # Show backtraces for deprecated behavior for quicker cleanup. ActiveSupport::Deprecation.debug = true -- cgit v1.2.3 From 80df74bf515124c9db85d4a670989ae5cc28c3ec Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Sat, 8 Jan 2011 18:33:33 +0000 Subject: Enable the sqlite3 in-memory test connection to work --- activerecord/test/cases/helper.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index f9bbc5299b..51104d9cf5 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -26,6 +26,11 @@ def current_adapter?(*types) end end +def in_memory_db? + current_adapter?(:SQLiteAdapter) && + ActiveRecord::Base.connection_pool.spec.config[:database] == ":memory:" +end + def with_env_tz(new_tz = 'US/Eastern') old_tz, ENV['TZ'] = ENV['TZ'], new_tz yield @@ -100,11 +105,11 @@ class ActiveSupport::TestCase end end -# silence verbose schema loading -original_stdout = $stdout -$stdout = StringIO.new +def load_schema + # silence verbose schema loading + original_stdout = $stdout + $stdout = StringIO.new -begin adapter_name = ActiveRecord::Base.connection.adapter_name.downcase adapter_specific_schema_file = SCHEMA_ROOT + "/#{adapter_name}_specific_schema.rb" @@ -117,6 +122,8 @@ ensure $stdout = original_stdout end +load_schema + class << Time unless method_defined? :now_before_time_travel alias_method :now_before_time_travel, :now @@ -133,4 +140,3 @@ class << Time @now = nil end end - -- cgit v1.2.3 From 4e19ec566c9132b85fdf0ff13a328238a6aca591 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Sun, 9 Jan 2011 15:52:41 +0000 Subject: In a number of places in the tests, we only need to turn off transactional fixtures when the DB does not support savepoints. This speeds the test run up by about 8-9% on my computer, when running rake test_sqlite3_mem :) --- activerecord/test/cases/helper.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 51104d9cf5..2cc993b6ed 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -31,6 +31,10 @@ def in_memory_db? ActiveRecord::Base.connection_pool.spec.config[:database] == ":memory:" end +def supports_savepoints? + ActiveRecord::Base.connection.supports_savepoints? +end + def with_env_tz(new_tz = 'US/Eastern') old_tz, ENV['TZ'] = ENV['TZ'], new_tz yield -- cgit v1.2.3 From 59f7780a3454a14054d1d33d9b6e31192ab2e58b Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 4 Feb 2011 18:08:31 -0800 Subject: adjust query counts to be consistent across databases, make sure database log the same things --- activerecord/test/cases/helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 2cc993b6ed..97bb631d2d 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -50,7 +50,7 @@ ensure end ActiveRecord::Base.connection.class.class_eval do - IGNORED_SQL = [/^PRAGMA/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/, /SHOW FIELDS/] + IGNORED_SQL = [/^PRAGMA (?!(table_info))/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/] # FIXME: this needs to be refactored so specific database can add their own # ignored SQL. This ignored SQL is for Oracle. -- cgit v1.2.3 From 1193709cd693099488353c20f2c7fadcf9cd6d05 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 7 Feb 2011 14:35:00 -0800 Subject: removing some freedom patches. use notification system to count sql queries --- activerecord/test/cases/helper.rb | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 97bb631d2d..499b30b4e8 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -49,28 +49,29 @@ ensure ActiveRecord::Base.default_timezone = old_zone end -ActiveRecord::Base.connection.class.class_eval do - IGNORED_SQL = [/^PRAGMA (?!(table_info))/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/] +module ActiveRecord + class SQLCounter + IGNORED_SQL = [/^PRAGMA (?!(table_info))/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/] - # FIXME: this needs to be refactored so specific database can add their own - # ignored SQL. This ignored SQL is for Oracle. - IGNORED_SQL.concat [/^select .*nextval/i, /^SAVEPOINT/, /^ROLLBACK TO/, /^\s*select .* from ((all|user)_tab_columns|(all|user)_triggers|(all|user)_constraints)/im] + # FIXME: this needs to be refactored so specific database can add their own + # ignored SQL. This ignored SQL is for Oracle. + IGNORED_SQL.concat [/^select .*nextval/i, /^SAVEPOINT/, /^ROLLBACK TO/, /^\s*select .* from ((all|user)_tab_columns|(all|user)_triggers|(all|user)_constraints)/im] - def execute_with_query_record(sql, name = nil, &block) - $queries_executed ||= [] - $queries_executed << sql unless IGNORED_SQL.any? { |r| sql =~ r } - execute_without_query_record(sql, name, &block) - end + def initialize + $queries_executed = [] + end - alias_method_chain :execute, :query_record + def call(name, start, finish, message_id, values) + sql = values[:sql] - def exec_query_with_query_record(sql, name = nil, binds = [], &block) - $queries_executed ||= [] - $queries_executed << sql unless IGNORED_SQL.any? { |r| sql =~ r } - exec_query_without_query_record(sql, name, binds, &block) + # FIXME: this seems bad. we should probably have a better way to indicate + # the query was cached + unless 'CACHE' == values[:name] + $queries_executed << sql unless IGNORED_SQL.any? { |r| sql =~ r } + end + end end - - alias_method_chain :exec_query, :query_record + ActiveSupport::Notifications.subscribe('sql.active_record', SQLCounter.new) end ActiveRecord::Base.connection.class.class_eval { -- cgit v1.2.3 From 30bba95a048af7f64724fe2450ad14967581a456 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 7 Feb 2011 15:12:21 -0800 Subject: update ignored SQL for oracle --- activerecord/test/cases/helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 499b30b4e8..8c001096cc 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -55,7 +55,7 @@ module ActiveRecord # FIXME: this needs to be refactored so specific database can add their own # ignored SQL. This ignored SQL is for Oracle. - IGNORED_SQL.concat [/^select .*nextval/i, /^SAVEPOINT/, /^ROLLBACK TO/, /^\s*select .* from ((all|user)_tab_columns|(all|user)_triggers|(all|user)_constraints)/im] + IGNORED_SQL.concat [/^select .*nextval/i, /^SAVEPOINT/, /^ROLLBACK TO/, /^\s*select .* from all_triggers/im] def initialize $queries_executed = [] -- cgit v1.2.3 From 5f1ea2a26b6e29f235e132d565b53f12e0234c66 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 7 Feb 2011 15:28:49 -0800 Subject: we do not use this method, so delete --- activerecord/test/cases/helper.rb | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 8c001096cc..1019ea1dda 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -74,18 +74,6 @@ module ActiveRecord ActiveSupport::Notifications.subscribe('sql.active_record', SQLCounter.new) end -ActiveRecord::Base.connection.class.class_eval { - attr_accessor :column_calls - - def columns_with_calls(*args) - @column_calls ||= 0 - @column_calls += 1 - columns_without_calls(*args) - end - - alias_method_chain :columns, :calls -} - unless ENV['FIXTURE_DEBUG'] module ActiveRecord::TestFixtures::ClassMethods def try_to_load_dependency_with_silence(*args) -- cgit v1.2.3 From 8ce57652b224c01d474ef20b27ea3c3838534467 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 8 Feb 2011 13:13:04 -0800 Subject: ignore max identifier length queries from pg --- activerecord/test/cases/helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 1019ea1dda..7e9007ef73 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -51,7 +51,7 @@ end module ActiveRecord class SQLCounter - IGNORED_SQL = [/^PRAGMA (?!(table_info))/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/] + IGNORED_SQL = [/^PRAGMA (?!(table_info))/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/, /^SHOW max_identifier_length/] # FIXME: this needs to be refactored so specific database can add their own # ignored SQL. This ignored SQL is for Oracle. -- cgit v1.2.3 From fb09d025429d1c1f05a705a231edb9938ccff9b0 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 11 Feb 2011 14:33:03 -0800 Subject: refactor fixtures to do less work in the constructor --- activerecord/test/cases/helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index 7e9007ef73..be508e46f8 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -94,7 +94,7 @@ class ActiveSupport::TestCase self.use_transactional_fixtures = true def create_fixtures(*table_names, &block) - Fixtures.create_fixtures(ActiveSupport::TestCase.fixture_path, table_names, {}, &block) + Fixtures.create_fixtures(ActiveSupport::TestCase.fixture_path, table_names, fixture_class_names, &block) end end -- cgit v1.2.3 From f1778eb44a71595dff271001ee19c7bf6d0a0101 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Tue, 15 Feb 2011 12:40:41 -0300 Subject: Run tests without IdentityMap when IM=false is given. --- activerecord/test/cases/helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/test/cases/helper.rb') diff --git a/activerecord/test/cases/helper.rb b/activerecord/test/cases/helper.rb index ad0430a92f..fd20f1b120 100644 --- a/activerecord/test/cases/helper.rb +++ b/activerecord/test/cases/helper.rb @@ -27,7 +27,7 @@ ActiveSupport::Deprecation.debug = true QUOTED_TYPE = ActiveRecord::Base.connection.quote_column_name('type') # Enable Identity Map for testing -ActiveRecord::IdentityMap.enabled = true +ActiveRecord::IdentityMap.enabled = (ENV['IM'] == "false" ? false : true) def current_adapter?(*types) types.any? do |type| -- cgit v1.2.3