root/trunk/test/client/test_bdrb_connection.rb

Revision 327, 1.1 kB (checked in by gethema..@gmail.com, 5 months ago)

sync code with git

Line 
1 require File.join(File.dirname(__FILE__) + "/../socket_mocker")
2 require File.join(File.dirname(__FILE__) + "/../bdrb_test_helper")
3 require File.join(File.dirname(__FILE__) + "/../bdrb_client_test_helper")
4
5 context "For Actual BackgrounDRB connection" do
6   setup do
7     options = {:schedules => {
8         :foo_worker => { :barbar=>{:trigger_args=>"*/5 * * * * * *"}}},
9       :backgroundrb=>{:port=>11008, :ip=>"0.0.0.0", :environment=> "production"},
10       :client => "localhost:11001,localhost:11002,localhost:11003"
11     }
12     BDRB_CONFIG.set(options)
13     @cluster = mock()
14     @foo_connection = BackgrounDRb::Connection.new('localhost',1267,"crap")
15     @foo_connection.stubs(:close_connection)
16     class << @foo_connection
17       attr_accessor :outgoing_data
18       def dump_object data
19         @outgoing_data = data
20       end
21     end
22   end
23
24   specify "should return nil if ask_result returns nil" do
25     a = @foo_connection.ask_result(:worker => 'foo_worker',:worker_key => 'bar',:job_key => 10)
26     a.should == nil
27     @foo_connection.outgoing_data.should == {:type=>:get_result, :job_key=>10, :worker=>"foo_worker", :worker_key=>"bar"}
28   end
29 end
Note: See TracBrowser for help on using the browser.