Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:rails/rails
Browse files Browse the repository at this point in the history
  • Loading branch information
rick committed Apr 18, 2008
2 parents 750e321 + 82b4faf commit 69d29e8
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 8 deletions.
File renamed without changes.
9 changes: 6 additions & 3 deletions actionpack/test/controller/dispatcher_test.rb
Expand Up @@ -37,11 +37,14 @@ def test_leaves_dependencies_after_dispatch_if_not_in_loading_mode
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 }

Expand Down
6 changes: 4 additions & 2 deletions activerecord/lib/active_record/migration.rb
Expand Up @@ -364,8 +364,10 @@ def schema_migrations_table_name
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)
Expand Down
9 changes: 8 additions & 1 deletion activerecord/test/cases/migration_test.rb
Expand Up @@ -813,6 +813,13 @@ def test_migrator_interleaved_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
Expand Down Expand Up @@ -1010,7 +1017,7 @@ def with_env_tz(new_tz = 'US/Eastern')
end

end

uses_mocha 'Sexy migration tests' do
class SexyMigrationsTest < ActiveRecord::TestCase
def test_references_column_type_adds_id
Expand Down
3 changes: 2 additions & 1 deletion activesupport/lib/active_support/cache/mem_cache_store.rb
Expand Up @@ -15,9 +15,10 @@ module Response

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)
Expand Down
13 changes: 13 additions & 0 deletions activesupport/test/caching_test.rb
Expand Up @@ -18,6 +18,19 @@ def test_mem_cache_fragment_cache_store
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")
Expand Down
2 changes: 1 addition & 1 deletion 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

0 comments on commit 69d29e8

Please sign in to comment.