rails

Rake script for managing Rails plugins with Git submodules

Problem with gitmodules and rails plugins

Submodules aren’t very easy. You have to know a few things before messing with them. When installing you have to follow a bunch of steps in order to get them properly registered within git. Uninstalling is even sadder. You need to manually edit a couple of git config files, and [...]

Getting Rails 2.3.3 and Mocha >=0.9.6 to play nice with Test::Unit and Shoulda

Simultaneous changes in Rails 2.3.3 and Mocha >=0.9.6 have caused some headaches in test::unit (or shoulda) tests. In my case I saw anomalies such as expectations persisting across tests. You put expects(:foo).never in test A and get “unsatisfied expectation” failure in test B where you happen to call :foo. This is due to unfortunate dependency [...]

Avoiding nested blocks

Today I had to silence some output streams so that messages don’t pollute the STDOUT. I used the silence_stream method built into Rails, described well in this article.

  silence_stream(STDOUT) do     # …my code…   end

Very nice, except I also wanted to filter STDERR output. Not a problem.

  silence_stream(STDOUT, STDERR) do     # …my code…   end

Well, [...]