July 2010
13 posts
3 tags
1 tag
Quick Tip: Ruby Class Definition
Everyone knows this syntax
class Foo
end
This is cleaner when you just need to quickly define an empty class:
Foo = Class.new
I’m writing this ActiveRecord compliant in memory model implementation called Glamazon for this secret project I’m on at work. I used Class.new’s ability to take a block as the class body to include my library into a testable class, e.g.
Mule =...
7 tags
A Tasty RSpec Morsel
RSpec’s let method is not hugely known but it’s very useful for DRYing up one’s specs. It accepts a symbol and a lazily evaluated block that defines a method when the method name is called
let(:foo) { puts 'METAPROGRAMMING FTW!' }
Even less known is that due to way Ruby (< 1.9) works under the covers, one can pass in block variables and have the method magically accept...
If you’re still doing things the same way you did two years ago, or even...
– Mint Digital
7 tags
Processing streaming JSON asynchronously is a...
At work we are planning a redesign of our architecture into a services oriented style. It makes a lot of sense for us and will enable us to scale the areas of the application that need it while avoiding us wasting extra resources on areas of the application that are doing just fine as they are. It’s some seriously sexy shit, trust me. That and working with insanely smart cats has me jumping...
6 tags
Shoulda: with vs. without
ActiveRecord spec without shoulda:
describe Address do
let(:address) { Factory.build :valid_address }
%w(street_address locality region postal_code country).each do |attribute|
it "is invalid without #{attribute}" do
address.send "#{attribute}=", nil
address.should_not be_valid
address.errors.on(:"#{attribute}").should include "can't be blank"
address.send...
keyboard + sg + boredom = …
i’m going to knock this blog on the head soon. having this persona as a cocky git is all well and good, but now i am making serious fucking cake participating in and owning startup companies, i want people to want me to win and evangelise projects i am involved with. being a dick is not conducive to this end. as my life goes on and more and more lucrative opportunities arise, public casual...
diego maradona