Permalink
Browse files

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

  • Loading branch information...
2 parents 750e321 + 82b4faf commit 69d29e80f76079262f2e98e350592be1cfdfcd1e rick committed Apr 18, 2008
View
0 activerecord/.gitignore → .gitignore
File renamed without changes.
View
9 actionpack/test/controller/dispatcher_test.rb
@@ -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 }
View
6 activerecord/lib/active_record/migration.rb
@@ -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)
View
9 activerecord/test/cases/migration_test.rb
@@ -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
@@ -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
View
3 activesupport/lib/active_support/cache/mem_cache_store.rb
@@ -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)
View
13 activesupport/test/caching_test.rb
@@ -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")
View
2 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.