Guard with OS X Lion Notification

Since Lion has notification center built-in, I do not want to install Growl again. It would be great if I don’t have to switch between editor and terminal to see if all of my tests passed whenever I saved a file. Turned out, with the latest guard with Terminal notification, I got what I wished.

In case you don’t know what guard is, you should check out Ryan Bate’s Railscast on Guard.

Update your guard with bundle update guard, and add the following in your Gemfile:

group :development do
  gem 'terminal-notifier'



Testing Resque background jobs with RSpec

Let’s say you have a model which involves a background job upon save, or you want to schedule a background job in the controller, how to do you make sure the background will run correctly? One way is to use expectation mock like Resque.should_receive(:enqueue).with(…), but a simpler/better way is just put the following in your before…end block:

Resque.inline = true

That will run your background job right away.