Merb + RSpec: Testing Requests with Cookies

Posted by Chris on June 07, 2009

I’ve been doing quite a bit of test driven development lately with Merb and Rspec. Tonight I banged my head against the wall for several hours trying to get cookies to pass to a strategy via a request() call. I finally got it working. I figure I would share this with the world in hopes that I save some other poor SOB hours of frustration.

Here is the code along with the strategy to give you a complete picture of what’s going on:

My first attempt at this was to setup a cookie jar using Merb::Test::CookieJar and then updating the cookies using the example.org domain. Fail! Then I scoured the web looking for any hints. When all that failed too I had to hit the Merb source code and examine what was really going on. Bingo… just pass it an array of raw cookies and let it do the rest.

Thank god for Open Source!

(BTW… I’m a bit new at both Merb and RSpec so take care with trashing my code)

An Evening with Tom Ritchey

Posted by Chris on January 23, 2009

Last night I had the pleasure of attending an event hosted by Palo Alto Bicycles featuring Tom Ritchey (yes, he is the same guy who’s name is on your bike). Originally, I was planning on driving over but when I got home last night I had a sudden urge to hop on my bike and ride over instead. I’m always looking for a good excuse to go for a ride these days. Plus I really wanted to try out my Fenix L2D with some full on night riding.

I quickly changed into some inconspicuous riding gear and headed out into the dark night. I took my usual route towards Palo Alto and then detoured onto the Ellen Fletcher Bike Boulevard. For those who don’t know what a Bike Boulevard is it’s basically a street which is primary focused on creating a convenient and safe route for cyclist. It’s restricted by barriers which are passable by cyclists and designed to reduce automobile traffic (That’s not the official description).

I got to Palo Alto bicycles just in time to grab a seat and see the beginning on his presentation. He broke it up into three parts. The first was about his life growing up in Palo Alto and the people who influence him. He talked about the Jobst Rides and what a profound impact Jobst made on his life. He also continued to go through the history of Ritchey (the company).

All along the way he would throw in little antidotes like how Jobst begrudgingly let Tom build him a frame and Jobst decided to design Tom a logo (which is the same one he uses today). Tom also talked about his relationships with Gary Fischer and Joe Breeze , he touched on the birth of the mountain bike movement and went into some of his relationships with his riders. It was an amazing walk through his history.

His second part was about his travels to Rwanda and the foundation he started, Project Rwanda. He showed wonderful pictures of the landscape and how beautiful the country is. He also showed photos of the wooden bikes people use to haul stuff around. Huge 200lb loads of water, bananas, coffee beans, potatoes, you name it they hauled it.

He explained how a bike in Rwanda really represents freedom. He showed examples of typical bikes he saw there. They ranged from wooden bikes made with scraps to 100 year old bikes with rebar used for spokes and most of them were practically un-rideable by American standards, but they still ride.

He then went into what Project Rwanda’s goals are and how they are trying to develop a sustainable economy with the bicycle. He told a story about how with the right bike, coffee bean farmers could get their beans to the washing station quicker and produce a higher quality bean which would help energize their economy.

Along the way he would touch on topics like the genocide and how the country was dealing with reconciling the past. You could tell that his time in Rwanda has had a deep impact into Tom’s perspective on life and it’s changed his outlook.

After the last presentation he invited everyone who didn’t need to take off right away to stick around while he went through some more slides of his travels to Slovenia. Unfortunately, at that point it was time for me to start heading home… There is nothing like riding home while being inspired.

This morning when I got into work I noticed that my unused $50 donation gift certificate that Yahoo! had givin me for Xmas was still sitting on my desk under a pile of cords. I opened it up and logged into the donation site and pledged my gift contribution to them. If you would like to get involved or make a donation please visit Project Rwanda.

Project Rwanda Web Site

Knee Pain Bike Haiku

Posted by Chris on January 16, 2009

My knees have some pain

Is the bike to blame today?

What a fucking shame.

Drugs (not the fun ones) 3

Posted by Chris on January 02, 2009

For some reason I’m really resistant to taking drugs when I need to. The really strange part is that I take my Prilosac every night without fail but anything else and I tend to shy away. I feel pretty comfortable with Prilosac for my GERD because I’ve been told by just about every professional that it’s the best drug ever made.

Lately I’ve been taking ibuprofen at night to help with my knee pain so I can get some quality sleep. The last few days I’ve been having quite a bit of pain in through out the day. It’s irritating because I’ve been doing everything I can to take it easy, I’ve even made Amanda take stuff down to the storage closet (and felt kind of jerky about it), but still the pain.

Yesterday I decided to take ibuprofen through out the day and it’s done wonders to dull the pain (even remove it completely). My concern as usual is that I have to start taking this longer term in order to avoid knee pain and I’m worried that that will cause some kind of bad side effect.

I’ve come to the conclusion that I’m going to have to start accepting the lesser of two evils with regards to my knees and health. If you recall I was trying to get rid of my knee straps and take a break. Even the little bit of riding I’ve done without them has “probably” cause this recent flair up. On the other hand if I use them I can start to loose some of this excess weight I’ve put on since September.

I think at this point I need to address my weight before it becomes real problem and learn to live with using the knee straps for a while till I have things back under control. I also have a doctor’s appointment on Tuesday to revisit my knee issues… hopefully we can come up with a plan for my recovery.

A few random thoughts 4

Posted by Chris on December 27, 2008

Over the last couple of days I’ve thought of a few things I wanted to post about but didn’t have enough substance to fill an entire blog post. I know that Twitter is good for these types of things but some of the thoughts can’t really be summarized into 140 characters either. So here are a few random thoughts…

Nice bike, is that your commuter?

Yet another shot of the Surly with fenders

Often when people see my bike the phrase above is usually the first thing they blurt out of their mouth. I’m not really sure how to answer this question. Yes I do commute on it but I wouldn’t necessarily say it’s my commuter bike. It’s also the bike I ride on group rides, off-road rides, solo rides and I hope to be able to do some bike camping with it in the spring. It also happens to be my only bike which is pretty rare for a bike fanatic like myself.

Yes it’s heavy but you can hardly notice it since it’s also very comfortable and speed is not very important to me (anymore). I think it’s kind of silly to worry about weight with the style of riding I do (did you notice the triple crankset and the big ass gears… those make any bike light).

The one thing I’ve learned from my injury is that I really just love being on my bike and riding. Thinking back to how this injury started, my goal last year was to get faster, attempting to get faster got me into this knee pickle. Now I just want to be able to ride my bike a lot and without pain.

Is this working?

I got some new ice packs.

My last post I mentioned I have a new plan: stop riding with the knee straps and continue my rehab exercise (and limit my riding to commuting/errands). Since I started doing the exercises again my knees have been aching a bit more or at least I feel like they have.

Sometimes it’s hard to tell if this stuff is working it seems like there are days where I feel like I’ve made progress and then there are other days where I’m no better off. I’ve also stared stretching daily and using the foam roller.

Today I feel like I’ve made progress since my ride was really fun and I’m not having much pain (well, much more pain then normal). Ibuprofen and Coors Light helps too.

Daddy’s face is itchy!

The beard is coming along nicely

I’ve decided to grow a beard (or just stop shaving… I’m that lazy). Amanda doesn’t like it very much but I’ve kind of grown attached to it. I just wanted something different… It was either this or a pink mohawk!