I don't think it matters, but you could also use a stub here. Also, map implicitly converts a range into an array:
```
invocations = (1..num_threads).map do |i|
  (conn = stub(:num => i)).expects(:close)
  conn
end
```