October 2009
10 posts
2 years of hackfests
On Tuesday, we’ll be hosting the November Boston.rb hackfest at the thoughtbot Boston office. This marks two years and about 30 total hackfests we’ve held here.
If you’ve never attended, please join us the first Tuesday night of every month. All skill levels and backgrounds are welcome.
attendance award
Josh Nichols deserves special recognition for attendance. He has...
Sharing assertions between Cucumber and Test::Unit
YO CUCUMBER, imma let you finish but according to rake stats, my units have the best collection of hand-rolled assertions of ALL TIME.
Guinea Pigs Battle for Cucumber: a compelling and entertaining short film
How to share with Cucumber
The gist is this: declare your assertions in a TestSupport::Assertions module, inside test/support — feel free to split them up into multiple files,...
3 tags
Have you ever...faked it?
I’ll admit it - I’ve faked it. Sometimes, you just can’t wait for a service to finish and you just want to fake a satisfactory response. There are lots of techniques for doing this: stubs, mocks, spies, and fakes. A full fake object will require more up-front effort than a quick stub, but they can be more reusable, reliable, and fail-proof.
Keeping your tests local
Probably...
Video: Sinatra at Boston.rb, part 3
This is the third in a series of short videos. They feature Blake Mizerany discussing Sinatra and Heroku in great technical detail at September’s Boston.rb. Watch Part 1 and Part 2 if you’d like.
legacy APIs
Blake uses “legacy APIs” as a common use case for Sinatra. The reason params[:splat] and params[:matches] and super-flexible routing in Sinatra exists is because of...
4 tags
Video: Sinatra at Boston.rb, part 2
This is the second in a series of short videos. They feature Blake Mizerany discussing Sinatra and Heroku in great technical detail at September’s Boston.rb. Watch Part 1.
In HD this time… watch out, the kid is learning!
“use” is built-in
In this video, Blake extends his example code using Rack middleware from rack-contrib called Rack::AcceptFormat:
Adds a format...
6 tags
Video: Sinatra at Boston.rb, part 1
This the first in a series of short videos. They feature Blake Mizerany discussing Sinatra and Heroku in great technical detail at September’s Boston.rb.
Blake Mizerany wrote Sinatra in 2006 because he was working on a high traffic site with a lot of POSTs, PUTs, and DELETEs. GETs can be cached but the others cannot.
In this video, Blake discusses the following concepts as they apply...
6 tags
fundamentals: TDD a date helper
I want to format a date range in a view for our training app. This is a job for helpers. A fundamental skill for Rails developers is writing the helper using TDD. This process takes about 10 minutes and results in a confidence-building regression suite.
Working outside-in, we start in the interface:
<%= format_date_range(course.date_range) %>
Tests fail, “format_date_range”...
Slave to the intepreter
I think of Ruby as the “free love” language. Yet, even Ruby can put the programmer in chains.
klass
Ever seen code like this?
klass = Class.new
klass.class_eval do
def self.xyz
'xyz'
end
end
@model = klass.new
The programmer names the temporary variable “klass” to avoid a collision with the class keyword.
Bob Martin uses this as an anti-pattern,...
code cowboy
I’ve written before about lightweight access control using inherited_resource’s begin_of_association_chain and raising a 404.
I still prefer this approach in the vast majority of apps I work on, but it doesn’t work in the case where there is no relationship between a user and an object other than access control.
custom
Last week, I had a need to differentiate access...
Happy Birthday, Ralph
Please join the celebration.
Today is the 4th anniversary of the incorporation of thoughtbot, inc. (We previously existed as an MA state partnership - which turned 7 years old in July). October also marks our 4th anniversary of working almost exclusively with ruby and rails as a web application platform.
We’d like to thank our current and past employees for their commitment to...