From 86ba0068f138af96ca7ddd177c0c300b12f513a9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 2 Apr 2009 22:52:56 -0700 Subject: configurator: allow hooks to be passed callable objects Premade lambda/proc/Proc objects may all be passed, to the hooks, not just anonymous blocks. --- test/unit/test_configurator.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/unit/test_configurator.rb b/test/unit/test_configurator.rb index 284d727..46fc248 100644 --- a/test/unit/test_configurator.rb +++ b/test/unit/test_configurator.rb @@ -91,4 +91,19 @@ class TestConfigurator < Test::Unit::TestCase end end + def test_after_fork_proc + [ proc { |a,b| }, Proc.new { |a,b| }, lambda { |a,b| } ].each do |my_proc| + Unicorn::Configurator.new(:after_fork => my_proc).commit!(self) + assert_equal my_proc, @after_fork + end + end + + def test_after_fork_wrong_arity + [ proc { |a| }, Proc.new { }, lambda { |a,b,c| } ].each do |my_proc| + assert_raises(ArgumentError) do + Unicorn::Configurator.new(:after_fork => my_proc) + end + end + end + end -- cgit v1.2.3-24-ge0c7