diff options
-rw-r--r-- | .gitignore (renamed from activerecord/.gitignore) | 0 | ||||
-rw-r--r-- | actionpack/test/controller/dispatcher_test.rb | 9 | ||||
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 6 | ||||
-rw-r--r-- | activerecord/test/cases/migration_test.rb | 9 | ||||
-rw-r--r-- | activesupport/lib/active_support/cache/mem_cache_store.rb | 3 | ||||
-rw-r--r-- | activesupport/test/caching_test.rb | 13 | ||||
-rwxr-xr-x | cleanlogs.sh | 2 |
7 files changed, 34 insertions, 8 deletions
diff --git a/activerecord/.gitignore b/.gitignore index 2bf1ef8c0e..2bf1ef8c0e 100644 --- a/activerecord/.gitignore +++ b/.gitignore diff --git a/actionpack/test/controller/dispatcher_test.rb b/actionpack/test/controller/dispatcher_test.rb index 9f90872734..c4f49f1e16 100644 --- a/actionpack/test/controller/dispatcher_test.rb +++ b/actionpack/test/controller/dispatcher_test.rb @@ -37,11 +37,14 @@ class DispatcherTest < Test::Unit::TestCase dispatch end + # Stub out dispatch error logger + class << Dispatcher + def log_failsafe_exception(status, exception); end + end + def test_failsafe_response CGI.expects(:new).raises('some multipart parsing failure') - - ActionController::Routing::Routes.stubs(:reload) - Dispatcher.any_instance.stubs(:log_failsafe_exception) + Dispatcher.expects(:log_failsafe_exception) assert_nothing_raised { dispatch } diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 573c6a4f02..1d63bb2f84 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -364,8 +364,10 @@ module ActiveRecord end def current_version - Base.connection.select_values( - "SELECT version FROM #{schema_migrations_table_name}").map(&:to_i).max || 0 + version = Base.connection.select_values( + "SELECT version FROM #{schema_migrations_table_name}" + ).map(&:to_i).max rescue nil + version || 0 end def proper_table_name(name) diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 885d89b6da..c270230d67 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -813,6 +813,13 @@ if ActiveRecord::Base.connection.supports_migrations? end end + def test_migrator_db_has_no_schema_migrations_table + ActiveRecord::Base.connection.execute("DROP TABLE schema_migrations;") + assert_nothing_raised do + ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 1) + end + end + def test_migrator_verbosity ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1) assert PeopleHaveLastNames.message_count > 0 @@ -1010,7 +1017,7 @@ if ActiveRecord::Base.connection.supports_migrations? end end - + uses_mocha 'Sexy migration tests' do class SexyMigrationsTest < ActiveRecord::TestCase def test_references_column_type_adds_id diff --git a/activesupport/lib/active_support/cache/mem_cache_store.rb b/activesupport/lib/active_support/cache/mem_cache_store.rb index 88e324aa3a..9b787702b2 100644 --- a/activesupport/lib/active_support/cache/mem_cache_store.rb +++ b/activesupport/lib/active_support/cache/mem_cache_store.rb @@ -15,9 +15,10 @@ module ActiveSupport def initialize(*addresses) addresses = addresses.flatten + options = addresses.extract_options! addresses = ["localhost"] if addresses.empty? @addresses = addresses - @data = MemCache.new(addresses) + @data = MemCache.new(addresses, options) end def read(key, options = nil) diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index a038f29f53..09b56525e0 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -18,6 +18,19 @@ class CacheStoreSettingTest < Test::Unit::TestCase assert_kind_of(ActiveSupport::Cache::MemCacheStore, store) assert_equal %w(localhost), store.addresses end + + def test_mem_cache_fragment_cache_store_with_multiple_servers + store = ActiveSupport::Cache.lookup_store :mem_cache_store, "localhost", '192.168.1.1' + assert_kind_of(ActiveSupport::Cache::MemCacheStore, store) + assert_equal %w(localhost 192.168.1.1), store.addresses + end + + def test_mem_cache_fragment_cache_store_with_options + store = ActiveSupport::Cache.lookup_store :mem_cache_store, "localhost", '192.168.1.1', :namespace => 'foo' + assert_kind_of(ActiveSupport::Cache::MemCacheStore, store) + assert_equal %w(localhost 192.168.1.1), store.addresses + assert_equal 'foo', store.instance_variable_get('@data').instance_variable_get('@namespace') + end def test_object_assigned_fragment_cache_store store = ActiveSupport::Cache.lookup_store ActiveSupport::Cache::FileStore.new("/path/to/cache/directory") diff --git a/cleanlogs.sh b/cleanlogs.sh index a197441085..a4e6baf0df 100755 --- a/cleanlogs.sh +++ b/cleanlogs.sh @@ -1 +1 @@ -rm activerecord/debug.log activerecord/test/debug.log actionpack/debug.log +rm activerecord/debug.log activerecord/test/debug.log actionpack/debug.log activeresource/test/debug.log |