diff options
-rw-r--r-- | activesupport/test/buffered_logger_test.rb | 4 | ||||
-rw-r--r-- | activesupport/test/file_watcher_test.rb | 31 |
2 files changed, 8 insertions, 27 deletions
diff --git a/activesupport/test/buffered_logger_test.rb b/activesupport/test/buffered_logger_test.rb index 97c0ef14db..8d1b1c02c6 100644 --- a/activesupport/test/buffered_logger_test.rb +++ b/activesupport/test/buffered_logger_test.rb @@ -115,11 +115,9 @@ class BufferedLoggerTest < Test::Unit::TestCase def test_should_create_the_log_directory_if_it_doesnt_exist tmp_directory = File.join(File.dirname(__FILE__), "tmp") log_file = File.join(tmp_directory, "development.log") - assert !File.exist?(tmp_directory) + FileUtils.rm_rf(tmp_directory) @logger = Logger.new(log_file) assert File.exist?(tmp_directory) - ensure - FileUtils.rm_rf(tmp_directory) end def test_logger_should_maintain_separate_buffers_for_each_thread diff --git a/activesupport/test/file_watcher_test.rb b/activesupport/test/file_watcher_test.rb index 027453f86a..7b4d4be24f 100644 --- a/activesupport/test/file_watcher_test.rb +++ b/activesupport/test/file_watcher_test.rb @@ -80,27 +80,10 @@ end module FSSM::Backends class Polling - def initialize(options={}) - @handlers = [] - @latency = options[:latency] || 0.1 - end - - def add_handler(handler, preload=true) - handler.refresh(nil, true) if preload - @handlers << handler - end - - def run - begin - loop do - start = Time.now.to_f - @handlers.each { |handler| handler.refresh } - nap_time = @latency - (Time.now.to_f - start) - sleep nap_time if nap_time > 0 - end - rescue Interrupt - end + def initialize_with_low_latency(options={}) + initialize_without_low_latency(options.merge(:latency => 0.1)) end + alias_method_chain :initialize, :low_latency end end @@ -110,10 +93,10 @@ class FSSMFileWatcherTest < ActiveSupport::TestCase super monitor = FSSM::Monitor.new - monitor.path(path, '**/*') do |monitor| - monitor.update { |base, relative| trigger relative => :changed } - monitor.delete { |base, relative| trigger relative => :deleted } - monitor.create { |base, relative| trigger relative => :created } + monitor.path(path, '**/*') do |p| + p.update { |base, relative| trigger relative => :changed } + p.delete { |base, relative| trigger relative => :deleted } + p.create { |base, relative| trigger relative => :created } end @thread = Thread.new do |