spec/symphony/tasks/ssh_spec.rb
changeset 17 5db18679edcf
parent 4 3972315383b3
equal deleted inserted replaced
16:420037982f78 17:5db18679edcf
    36 		it "builds the proper command line" do
    36 		it "builds the proper command line" do
    37 			pipe = double( :fake_pipes ).as_null_object
    37 			pipe = double( :fake_pipes ).as_null_object
    38 			allow( IO ).to receive( :pipe ).and_return([ pipe, pipe ])
    38 			allow( IO ).to receive( :pipe ).and_return([ pipe, pipe ])
    39 
    39 
    40 			args = [
    40 			args = [
    41 				'-p', '22', '-i', '/tmp/sekrit.rsa', '-l', 'symphony', 'example.com'
    41 				'-p', '22', '-i', '/tmp/sekrit.rsa', '-l', 'symphony', 'example.com', 'woohoo'
    42 			]
    42 			]
    43 
    43 
    44 			expect( Process ).to receive( :spawn ).with(
    44 			expect( Process ).to receive( :spawn ).with(
    45 				*[ ssh.to_s, described_class.opts, args ].flatten,
    45 				*[ {}, ssh.to_s, described_class.opts, args ].flatten,
    46 				:out => pipe, :in => pipe, :close_others => true
    46 				out: pipe, in: pipe, close_others: true, unsetenv_others: true
    47 			).and_return( 12 )
    47 			).and_return( 12 )
    48 
    48 
    49 			expect( Process ).to receive( :waitpid2 ).with( 12 ).and_return([ 12, 1 ])
    49 			expect( Process ).to receive( :waitpid2 ).with( 12 ).and_return([ 12, 1 ])
    50 
    50 
    51 			code = instance.work( payload, {} )
    51 			code = instance.work( payload, {} )