Merge branch 'master' of git@github.com:rails/rails

This commit is contained in:
rick
2008-04-17 17:22:03 -07:00
7 changed files with 34 additions and 8 deletions

View File

@@ -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 }

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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")

View File

@@ -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