Archive for December 2007

YUI Pages plugin 0.1.0 released

Tonight I’m releasing version 0.1.0 of my new YUI Pages Rails plugin. Here’s a quick example of what it can do (from the README):

<% yui_page :width => YUIPages::PAGE_750, :secondary => YUIPages::RIGHT_180 do %>
  <% header do %>
    Page title
  <% end %>

  <% body do %>
    <% main do %>
      <% grid :columns => YUIPages::GRID_75_25 do %>
        <% unit do %>
          Content for the 75% width first column.
        <% end %>
        <% unit do %>
          Content for the 25% width second column.
        <% end %>
      <% end %>
    <% end %>

    <% secondary do %>
      Content for the 180px right sidebar.
    <% end %>      
  <% end %>

  <% footer do %>
    Footer links here
  <% end %>
<% end %>

This light (less than 90 lines of code) plugin saves me from having to remember or care about the YUI Grids CSS IDs and classes, and handles preparing correct markup regardless of my grid arrangement.

No more looking up that “yui-t3” means a 300px sidebar on the left or forgetting to class the first unit in a grid with “first” because I moved things around in my layout file. A small victory, but a victory nonetheless.

SVN is at http://svn.eastmedia.net/public/plugins/yui_pages/. Check out the full README.

"What's new in Rails 2?" slides posted

Thanks to everyone who attended my “What’s new in Rails 2?” talk last night at NYC.rb. The questions were great, and I picked up a few tips myself from the discussions we had.

Download the slides as a PDF (1.4 MB).

Save the date: GoRuCo will be April 26th, 2008

The second annual Gotham Ruby Conference a.k.a. GoRuCo will be held Saturday, April 26th 2008 at Pace University in Manhattan. Last year was a great day of learning and socializing with fellow Ruby geeks, and we expect this year to be even better. I’ll see you there!

Speaking at NYC.rb on Tuesday

On Tuesday, December 11th, I’ll be speaking at NYC.rb about “What’s new in Rails 2?”. Come by and watch or check back after then and I’ll be sure to have my slides up.

Webrat 0.1.0 released

Last week I pushed Webrat 0.1.0 out the door. So far the response has been great, and I’ve already received a couple patched (Thanks, David!). Here’s a quick usage example (from the README):

1
2
3
4
5
6
7
8
def test_sign_up
    visits "/"
    clicks_link "Sign up"
    fills_in "Email", :with => "good@example.com"
    select "Free account"
    clicks_button "Register"
    ...
  end

Behind the scenes, this will perform the following work:

  1. Verify that loading the home page is successful
  2. Verify that a “Sign up” link exists on the home page
  3. Verify that loading the URL pointed to by the “Sign up” link leads to a successful page
  4. Verify that there is an “Email” input field on the Sign Up page
  5. Verify that there is an select field on the Sign Up page with an option for “Free account”
  6. Verify that there is a “Register” submit button on the page
  7. Verify that submitting the Sign Up form with the values “good@example.com” and “Free account” leads to a successful page

Take special note of the things not specified in that test, that might cause tests to break unnecessarily as your application evolves:

  • The input field IDs or names (e.g. “user_email” or “user[email]”), which could change if you rename a model
  • The ID of the form element (Webrat can do a good job of guessing, even if there are multiple forms on the page.)
  • The URLs of links followed
  • The URL the form submission should be sent to, which could change if you adjust your routes or controllers
  • The HTTP method for the login request

A test written with Webrat can handle these changes smoothly.

SVN is at http://svn.eastmedia.net/public/plugins/webrat/. Check out the full README.