Permalink
Browse files

Added a unit test for multiple callbacks of the same type.

  • Loading branch information...
1 parent 25ca0d6 commit 3797100571e1d79d4cdd3e5939494b45bb479e5d Ilya Maykov committed Aug 23, 2011
Showing with 17 additions and 0 deletions.
  1. +17 −0 test/thrift_client_test.rb
View
17 test/thrift_client_test.rb
@@ -137,6 +137,23 @@ def test_unknown_cb
assert_equal(nil, r)
end
+ def test_multiple_cb
+ calledcnt = 0
+ client = ThriftClient.new(Greeter::Client, @servers, @options.merge(:retries => 2))
+ 2.times do |i|
+ r = client.add_callback :post_connect do |cl|
+ calledcnt += 1
+ assert_equal(client, cl)
+ end
+ assert_equal(client, r)
+ end
+ assert_nothing_raised do
+ client.greeting("someone")
+ client.disconnect!
+ end
+ assert_equal(2, calledcnt)
+ end
+
def test_no_servers_eventually_raise
wascalled = false
client = ThriftClient.new(Greeter::Client, @servers[0,2], @options.merge(:retries => 2))

0 comments on commit 3797100

Please sign in to comment.