Interesting Things

  • To run tests in parallel, one pivot experimented with two libraries: hydra and parallel_tests. He found that hydra was difficult to setup and eventually gave up to try parallel_tests. Setting up parallel_tests turned out to be quite simple and gave him about a 3x performance boost on an 8 core machine. Not linear with the number of cores but still significant.
  • Nate Clark recently released a new version of the Selenium RC gem which, among other things, fixes an issue causing tests to hang during initialization.
  • The RSpec =~ matcher (which asserts two arrays should contain the same elements) is still awesome.

Here is an example of using the =~ matcher:

[1,2,3].should =~ [1,2,3]   # => green
[1,2,3].should =~ [3,2,1]   # => green
[1,2,3,4].should =~ [3,2,1] # => red
[1,2].should =~ [3,2,1]     # => red

It also gives you a really useful failure message:

Failure/Error: [1,2,3,4].should =~ [3,2,1] # => red
  expected collection contained:  [1, 2, 3]
  actual collection contained:    [1, 2, 3, 4]
  the extra elements were:        [4]