about summary refs log tree commit homepage
path: root/test/test_watcher.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_watcher.rb')
-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/