about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-09-27 17:46:20 -0700
committerEric Wong <normalperson@yhbt.net>2011-09-27 19:51:19 -0700
commite974e26fcfb78cd579556495a0635d30ec5c6976 (patch)
treefec8faa7399d0e7b245bfff5f19f9fb59d923071 /test
parent9a42edb11efcd091623bb37a33a8ea97b39a1d85 (diff)
downloadraindrops-e974e26fcfb78cd579556495a0635d30ec5c6976.tar.gz
It can be useful to some to see that info all at once
without hitting the HTML index page.
Diffstat (limited to 'test')
-rw-r--r--test/test_watcher.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test_watcher.rb b/test/test_watcher.rb
index 86c97d8..11a2d86 100644
--- a/test/test_watcher.rb
+++ b/test/test_watcher.rb
@@ -96,4 +96,25 @@ class TestWatcher < Test::Unit::TestCase
       break
     end
   end
+
+  def test_x_current_header
+    env = @req.class.env_for "/active/#@addr.txt"
+    status, headers, body = @app.call(env)
+    assert_equal "0", headers["X-Current"], headers.inspect
+
+    env = @req.class.env_for "/queued/#@addr.txt"
+    status, headers, body = @app.call(env)
+    assert_equal "1", headers["X-Current"], headers.inspect
+
+    @ios << @srv.accept
+    sleep 0.1
+
+    env = @req.class.env_for "/queued/#@addr.txt"
+    status, headers, body = @app.call(env)
+    assert_equal "0", headers["X-Current"], headers.inspect
+
+    env = @req.class.env_for "/active/#@addr.txt"
+    status, headers, body = @app.call(env)
+    assert_equal "1", headers["X-Current"], headers.inspect
+  end
 end if RUBY_PLATFORM =~ /linux/