Skip to main content

Posts

Showing posts from April, 2010

Ruby: Modifying Class Attributes in Cucumber and RSpec

Imagine you're building Amazon.com, and you have a rating system. You might not want to show an average rating to the user until there's been some minimum number of ratings. Of course, you'll want to test that that feature works. However, in other tests, you might want to disable that feature by setting the minimum number of ratings required to 0.

More generally, I sometimes run into the situation where I have a constant in my model that I might want to change, but only for a specific test. Instead of using a constant, you can use a class attribute. However, since class attributes aren't part of a database transaction, they don't get reset after every test. That's a problem since one test that changes the class attribute might mysteriously break another test that relies on that class attribute. I had a problem where one feature file would pass when run alone, but it wouldn't pass when all the features files were run. Here's how to make it all wor…

ActionScript: Dynamic Streaming

There's an article here about dynamic streaming in Flash Media Server 3.5 using Flash 10's new QoS features. It's a three-part series, and I just spent several hours reading it.

It talks about a class that Adobe provides called "DynamicStream". It doesn't come with ActionScript 3.0--it's a separate download. I was hoping to integrate this class into JW Player in order to do more intelligent bitrate switching using Adobe's new QoS features.

Let me explain why I'm frustrated.

First of all, this article was a three-part series, each with several pages. Hence, it was very long--much longer than I think was necessary. Part 3 covered "Integrating dynamic streaming with existing video players". Since it was the final page in the entire series, I expected it to be very exciting and useful. Instead, it was very mediocre. I can summarize, "Hey, this stuff doesn't work in Flash 9, so you'll have to do something else to support old…