Let's say I am calling a Ruby method with a block argument in ruby:
Net::SFTP.start('testhost.com', 'test_user', keys: ['key']) do |sftp|
sftp.upload!('/local', '/remote')
end
How can I test that the upload! method was called with the correct arguments?
I could get this far, testing the arguments for #start,
expect(Net::SFTP).
to receive(:start) do |host, username, keyword_args, &block|
expect(host).to eq("testhost.com")
expect(username).to eq("test_user")
expect(keyword_args).to eq(keys: ["test_key"])
end
But I can't figure out how to test that #upload! was called in the block.