diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-12-24 13:23:32 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-12-24 13:28:57 -0800 |
commit | 9b46379f75f384c86e42046ab03ce55231197c92 (patch) | |
tree | 33ffd8703db04f1bc299df03f12673fda2f888c7 /test | |
parent | 8d58b42d0255880d732ba0700597b312a8219f8f (diff) | |
download | clogger-9b46379f75f384c86e42046ab03ce55231197c92.tar.gz |
This lessens confusion for people configuring Clogger in config.ru, since "File" could be mistaken for Rack::File and "::File" needs to be specified.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_clogger.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_clogger.rb b/test/test_clogger.rb index 1311017..9252a42 100644 --- a/test/test_clogger.rb +++ b/test/test_clogger.rb @@ -3,6 +3,7 @@ $stderr.sync = $stdout.sync = true require "test/unit" require "date" require "stringio" +require "tempfile" require "rack" @@ -629,4 +630,21 @@ class TestClogger < Test::Unit::TestCase end end if RUBY_PLATFORM =~ /linux/ && File.readable?(LINUX_PROC_PID_STATUS) + def test_path_open_file + tmp = Tempfile.new('test_clogger') + app = lambda { |env| [ 200, {}, [] ] } + app = Clogger.new(app, :format => '$status', :path => tmp.path) + assert_kind_of Integer, app.fileno + assert app.fileno != tmp.fileno + status, headers, body = app.call(@req) + assert_equal "200\n", tmp.read + end + + def test_path_logger_conflict + tmp = Tempfile.new('test_clogger') + app = lambda { |env| [ 200, {}, [] ] } + assert_raises(ArgumentError) { + Clogger.new(app, :logger=> $stderr, :path => tmp.path) + } + end end |