From 745359a49452da34978724144eaa318b8a363e08 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 15 Apr 2008 18:04:12 -0500 Subject: Stub out Dispatcher#log_failsafe_exception method to please the test gods. --- actionpack/test/controller/dispatcher_test.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 } -- cgit v1.2.3 From 9e53b63601ce12fb7e4c8fdb16d5706ea8609d2f Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Wed, 16 Apr 2008 13:17:03 -0500 Subject: Ignore debug logs and ensure ActiveResource's log is cleaned up. --- .gitignore | 1 + activerecord/.gitignore | 1 - cleanlogs.sh | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 .gitignore delete mode 100644 activerecord/.gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..2bf1ef8c0e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +debug.log \ No newline at end of file diff --git a/activerecord/.gitignore b/activerecord/.gitignore deleted file mode 100644 index 2bf1ef8c0e..0000000000 --- a/activerecord/.gitignore +++ /dev/null @@ -1 +0,0 @@ -debug.log \ No newline at end of file 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 -- cgit v1.2.3 From 9e1d506a8cfedef2fdd605e4cbf4bf53651ad214 Mon Sep 17 00:00:00 2001 From: jweiss Date: Thu, 17 Apr 2008 12:58:31 -0500 Subject: Support options passed to ActiveSupport::Cache :mem_cache_store [#14 state:resolved] Signed-off-by: Joshua Peek --- activesupport/lib/active_support/cache/mem_cache_store.rb | 3 ++- activesupport/test/caching_test.rb | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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") -- cgit v1.2.3 From 82b4faf81218bbd8916ab559590db236c7f80e46 Mon Sep 17 00:00:00 2001 From: Ian White Date: Thu, 17 Apr 2008 13:43:47 -0500 Subject: Fix migrations when migrating to a specified version number with a fresh database [#1 state:resolved] Signed-off-by: Joshua Peek --- activerecord/lib/active_record/migration.rb | 6 ++++-- activerecord/test/cases/migration_test.rb | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) 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 -- cgit v1.2.3