Skip to content

Commit 69d29e8

Browse files
author
rick
committed
Merge branch 'master' of git@github.com:rails/rails
2 parents 750e321 + 82b4faf commit 69d29e8

File tree

7 files changed

+34
-8
lines changed

7 files changed

+34
-8
lines changed
File renamed without changes.

actionpack/test/controller/dispatcher_test.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,14 @@ def test_leaves_dependencies_after_dispatch_if_not_in_loading_mode
3737
dispatch
3838
end
3939

40+
# Stub out dispatch error logger
41+
class << Dispatcher
42+
def log_failsafe_exception(status, exception); end
43+
end
44+
4045
def test_failsafe_response
4146
CGI.expects(:new).raises('some multipart parsing failure')
42-
43-
ActionController::Routing::Routes.stubs(:reload)
44-
Dispatcher.any_instance.stubs(:log_failsafe_exception)
47+
Dispatcher.expects(:log_failsafe_exception)
4548

4649
assert_nothing_raised { dispatch }
4750

activerecord/lib/active_record/migration.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,10 @@ def schema_migrations_table_name
364364
end
365365

366366
def current_version
367-
Base.connection.select_values(
368-
"SELECT version FROM #{schema_migrations_table_name}").map(&:to_i).max || 0
367+
version = Base.connection.select_values(
368+
"SELECT version FROM #{schema_migrations_table_name}"
369+
).map(&:to_i).max rescue nil
370+
version || 0
369371
end
370372

371373
def proper_table_name(name)

activerecord/test/cases/migration_test.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,13 @@ def test_migrator_interleaved_migrations
813813
end
814814
end
815815

816+
def test_migrator_db_has_no_schema_migrations_table
817+
ActiveRecord::Base.connection.execute("DROP TABLE schema_migrations;")
818+
assert_nothing_raised do
819+
ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 1)
820+
end
821+
end
822+
816823
def test_migrator_verbosity
817824
ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
818825
assert PeopleHaveLastNames.message_count > 0
@@ -1010,7 +1017,7 @@ def with_env_tz(new_tz = 'US/Eastern')
10101017
end
10111018

10121019
end
1013-
1020+
10141021
uses_mocha 'Sexy migration tests' do
10151022
class SexyMigrationsTest < ActiveRecord::TestCase
10161023
def test_references_column_type_adds_id

activesupport/lib/active_support/cache/mem_cache_store.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ module Response
1515

1616
def initialize(*addresses)
1717
addresses = addresses.flatten
18+
options = addresses.extract_options!
1819
addresses = ["localhost"] if addresses.empty?
1920
@addresses = addresses
20-
@data = MemCache.new(addresses)
21+
@data = MemCache.new(addresses, options)
2122
end
2223

2324
def read(key, options = nil)

activesupport/test/caching_test.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ def test_mem_cache_fragment_cache_store
1818
assert_kind_of(ActiveSupport::Cache::MemCacheStore, store)
1919
assert_equal %w(localhost), store.addresses
2020
end
21+
22+
def test_mem_cache_fragment_cache_store_with_multiple_servers
23+
store = ActiveSupport::Cache.lookup_store :mem_cache_store, "localhost", '192.168.1.1'
24+
assert_kind_of(ActiveSupport::Cache::MemCacheStore, store)
25+
assert_equal %w(localhost 192.168.1.1), store.addresses
26+
end
27+
28+
def test_mem_cache_fragment_cache_store_with_options
29+
store = ActiveSupport::Cache.lookup_store :mem_cache_store, "localhost", '192.168.1.1', :namespace => 'foo'
30+
assert_kind_of(ActiveSupport::Cache::MemCacheStore, store)
31+
assert_equal %w(localhost 192.168.1.1), store.addresses
32+
assert_equal 'foo', store.instance_variable_get('@data').instance_variable_get('@namespace')
33+
end
2134

2235
def test_object_assigned_fragment_cache_store
2336
store = ActiveSupport::Cache.lookup_store ActiveSupport::Cache::FileStore.new("/path/to/cache/directory")

cleanlogs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rm activerecord/debug.log activerecord/test/debug.log actionpack/debug.log
1+
rm activerecord/debug.log activerecord/test/debug.log actionpack/debug.log activeresource/test/debug.log

0 commit comments

Comments
 (0)