shoulda todo list integration test

One of the things I like most about TDD, and shoulda specifically, is that if a thought pops up of something I need to add I can add a deferred test and come back to it later. In shoulda you can do this with:

should_eventually "do something"

#or just leave off the block
should "do something"

This works great for models/controllers, but I also wanted a way to integrate a miscelanious todo list into the flow that would pop up in autotest or when running the whole test suite. To accomplish this I’ve been keeping a TodosTest in the integration tests directory:

require File.dirname(__FILE__) + '/../test_helper'

class TodosTest < ActionController::IntegrationTest
  context "TODO:" do
    todos = [
             'add the jquery rounded corners plugin',
             'add the jquery dropshadow plugin',
             'scope actions in application.js to specific pages'
            ]
    todos.each do |todo|
      should_eventually todo
    end
  end
end

The output of this is:

  * DEFERRED: TODO: should add the jquery rounded corners plugin.
  * DEFERRED: TODO: should add the jquery dropshadow plugin.
  * DEFERRED: TODO: should scope actions in application.js to specific pages.

Since this isn't really an integration test I usually add a line for this in the .gitignore.

Also - this is a handy bash alias to print the todo's without the deferred/should language:

alias todo="ruby test/integration/todos_test.rb | grep TODO | sed -e 's/DEFERRED: TODO: should //g'"

The cleaned up output is:

  * add the jquery rounded corners plugin.
  * add the jquery dropshadow plugin.
  * scope actions in application.js to specific pages.

Introducing Compost

This past weekend was the Rails Rumble and a team of intrepid blenderbox developers hunkered down in our Brooklyn headquarters and, in a mere 48 hours, produced a slick new web app: Compost.

Compost is the simple way to post, share, and present your design comps.

More than just a slideshow, Compost allows you to control your presentation and your message. Now your clients see what you want them to see, when you want them to see it.

Sharing comps is easy:

  1. Post. Give your gallery a name and upload your comps. Upload as many images as you need – all at once.
  2. Share. Invite people to view your new gallery. Emails are sent to your clients with a unique URL for their gallery.
  3. Present. Control your viewer’s experience in real-time – remotely! With complete control of your presentation, you decide when, and for how long, each image appears on-screen. The viewer – your client – sits back and watches the show.

Try it yourself.

A bash script for bootstrapping a Rails app with jRails/jQuery, rspec, restful-authentication, and a default controller.

Download from github:
http://github.com/npverni/rails-boilerplate-script

After running it in the root of a new Rails app you’ll be setup with:

  • Authentication via restful-authentication
  • the rspec plugins for BDD
  • the jRails drop-in replacement for using jQuery instaed of Proto/scriptaculous
  • A ‘welcome’ controller
  • A application.html.erb layout

The “tight collaboration” that created TimesPeople

Khoi Vinh on getting good ideas out faster by collaborating closely:

TimesPeople is the result of a tight collaboration between a small team of our technologists and designers and, for a new feature on our site, they managed to launch it in something like record time. It was actually a lot of fun bringing it to life, but the really important thing is the try-it-and-see approach that drove it. Rather than spend months and millions on creating the ‘perfect’ social networking addition to our site, we decided to take a good idea and get it out as quickly as possible. It’s certainly not perfect, but we’re hoping to learn as much as we can about how social networking makes sense in the Times environment.

From “People Wanted” (subtraction.com)

Managing 50+ blogs on nytimes.com

From Khoi Vinh’s ongoing Q&A session:

Over the past two-plus years, as The Times newsroom has embraced blogging with tremendous alacrity, we’ve created over 150 blogs, and over a third of those remain active today.

The challenge is even more complex when you consider that, though each blog has its own needs, the vast majority must be based on a single template (within WordPress, our Web log publishing system) that manages all of the blogs together. As you can imagine, that requires that the template be very versatile and that our designers be very nimble.

So by virtue of the fact that we’re constantly launching new blogs, we’re also in a perpetual state of revision and refinement. We’re fine-tuning the typography, adding new features to the right-hand column, incorporating new kinds of media content into the articles, etc. All of which is work that may then be reflected back on the other blogs.

I find this really remarkable. I can’t help but wonder how difficult it was to get stakeholders to agree to the constraints of a single WordPress template. By standardizing the blog creation process, they now have an agile publishing system that imposes creative constraints but has been able to grow rapidly with nytimes.com.

Imagine being the guy in charge of maintaining these blogs though.

mod_rails for Apache – the end of an era?

At the end of last week Phusion, a Netherlands based IT company, launched the Passenger gem, which acts as a mod_rails for Apache. Without going into the technical details, this is as close as Rails has come to having an ‘ftp files to the server and it works’ deployment method. With deployment being one of the steepest learning curves in the Rails world, this announcement could potentially be huge.

So what does this mean for developers who have been using Rails for several years and those who have yet to pick it up? Many Rails developers, who have seen the progression from CGI to FastCGI to Mongrel, Mongrel Cluster, Thin, etc, have been forced to learn a good amount about unix, apache, nginx, monitoring servers, watching processes, etc. Unix command line skills have gone hand in hand with Rails development up to this point. In fact, entire businesses such as Rails Machine, Engine Yard, Planet Argon, etc. are built around the fact that Rails is hard for the average person to deploy (not to mention great open source tools like capistrano, vlad and mongrel itself).

Is this the beginning of a new era for Rails where the last barrier to entry has been removed? It will be interesting to see what kind of effect this has on the current Rails community as real-world data becomes available.

Review: Developing Facebook Platform Applications with Rails by Michael J. Mangino

I spent most of this past weekend working through Michael J. Mangino’s book “Developing Facebook Platform Applications with Rails“(DFPAWR) from the Pragmatic Programmers. I’ve been interested in the facebook platform for awhile but the resources have mostly fallen into two categories: 1) Overly simple Hello World programs in PHP or 2) Exhaustive api references.

DFPAWR, which is still in Beta, walks the reader through creating a full application from start to finish using Chad Fowler’s excellent Facebooker library for Rails. While this is definietly a Rails-centric book, the author provides the underlying FBML code first and then explains how to achieve the same effect using the simplified syntax of the Facebooker library.

It should be noted that the book assumes a strong understanding of the Rails framework. However, this assumption is one of the book’s biggest strengths. DFPAWR is a perfect example of how fast author and reader can hit the ground running when they already speak the same language. Michael Mangino clearly knows his subject matter and readily points out many of the common pitfalls, security concerns, and Facebook terms of use issues (i.e. you can’t store a username in a local database) that those new to the platform would have to stumble through themselves.

It’s a great resource for Rails developers looking to get started on Facebook apps, and with mod_rails on the way it’s never been easier.

flash projects

While perusing the ever important osflash.org in preparation for some upcoming flash work, I came across some really great open source flash projects I thought might be interesting to some.

  • movie masher

    Facilitates easy navigation of video, audio and image assets as well as effects, transitions and themes. Media can simply be dragged into the timeline for inclusion in a mash.
  • swf address

    A small, but powerful library that provides deep linking for Flash and Ajax
  • ajax animator

    Ajax Animator is a free open source web based flash ide designed for simplicity and community effort.

The only issue I have with osflash is that a lot of the projects are out-dated and not removed or tagged as being so, and it can become difficult to figure out if it is still applicable.

Read this post in Safari 3.1

Safari 3.1 (released yesterday) offers support for some new HTML & CSS features. There’s a demo on MacRumors.

One of the most exciting, I think, is downloadable font support — you can link to actual font files from the CSS instead of having to use the common “web safe” fonts.

All of these features are just eye candy until Firefox and IE support it, but it offers a little glimpse into the future of web design & development.

Coding for the mobile web

An Opera developer writes up a comprehensive overview of the state of the mobile web design industry. Let me summarize, since it’s a long article:

  • The iPhone is one slice of a much larger mobile market
  • Mobile browsers are divided into two categories: full-featured (Opera Mobile and Safari) and constrained (WinWAP, Pocket IE, Blazer)
  • Javascript support on mobile devices is uneven, always provide a fallback
  • Design for 240 x 320; assume you’ll have a limited color palette to use and limited control over typography
  • Plan for two distinct user experiences: Don’t ever assume that your web-based user experience will be the same on a mobile device
  • Build one site that degrades well on mobile devices instead of building a second website just for mobile users
  • Make use of the “handheld” media type for CSS