RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
 

vitobotta — 4 posts

http://vitobotta.com

The title says it all - here's a gentle introduction to some common bitwise operations with the Ruby language, as well as an example of how to apply such operations to simplify some testing scenarios in Rspec.

http://vitobotta.com/applying-bitwise-operations-to-rspec-testing/
If you use Resque for your background jobs, and have to manually intervene when workers get stuck or jobs fail for some reason, you might find this tip useful. It's a simple way of monitoring for stuck Resque workers, and automatically kill those workers and retry failed jobs.
In RSpec it is possible to define special custom matchers that enable us to test, with a neat syntax, what happens when some code is executed, while also helping reduce duplication.

This blog post shows how to define such matchers and how they work behind the scenes thanks to Ruby's magic.

Custom RSpec matchers for blocks, and the Ruby magic behind their inner workings
A quick tip for those who may have not noticed that Ruby 1.9.2 and 1.9.3 are significantly slower than 1.8.7 at loading Rails 3 apps; as a result, Rails 3 apps' startup takes much longer, affecting - for example - testing, firing up consoles, and so on. So I wrote a short post on how to patch the latest stable version of Ruby (p290) with a version of the 'fast require' patch that works with this revision, so to improve startup time with Rails 3/3.1 apps - plus a mention on a couple issues when installing Ruby with this patch and packages such as readline, iconv, at the same time.

Rails 3.1 and installing Ruby 1.9.2-p290 with the 'fast require' patch, readline, iconv