Posted by Eric Kidd
Wed, 15 Feb 2006 13:06:00 GMT
Like most Ruby on Rails developers, I write lots of test cases for
my models and controllers. This lets me add new features quickly, without
worrying about breakage: My test cases act as a safety net, warning me
whenever existing code fails.
Sadly, it’s much harder to test client-side behavior. Sure, you know your
controllers work, but what actually happens if a user clicks the Submit
button? We need a better way to test the system end-to-end, including the actual JavaScript and
web browsers.
This article shows how to combine Selenium, Selenium on Rails, and a
custom patch to write client-side test cases in Ruby:
test.setup
test.open :controller => 'customer',
:action => 'list'
test.assert_title 'Customers'
test.click 'myLink', :wait => true
test.assert_title 'Customer: *'
These test cases actually run in your browser, loading pages and clicking links just as a user would. As the above example shows, you have full access to the Rails environment, including URL routing and configuration data.
Read more...
Tags Hacks, Rails, Selenium, testing | 1 comment
Posted by Eric Kidd
Wed, 16 Nov 2005 03:13:00 GMT
This weekend, I moved Random Hacks to Typo, a nifty Rails-based blogging system. Here’s what I did:
- Set up my Mac for Rails development
- Pointed Typo at MySQL
- Created a custom theme
- Wrote an article importer
- Routed my old URLs to new locations
- Wrote some custom sidebars
- Configured Debian’s mod_fcgid
Now for the gruesome details.
Read more...
Tags Rails, Ruby, Typo
Posted by Eric Kidd
Mon, 14 Nov 2005 02:04:00 GMT
Here's two new plugins for Typo, the cool Rails-based blogging software. The first shows a list of recent comments. The second shows articles with a specific tag. (I use it to implement the "Recommended Reading" list in my sidebar.)
To install the plugins, simply unzip them in your Typo root directory, restart Typo, and take a look at the "Sidebar" tab in the admin screen.
These plugins were unbelievably simple to write. If you'd like to see how they work, keep reading.
Read more...
Tags Hacks, Rails, Typo | 4 comments
Posted by Eric
Tue, 11 Oct 2005 04:00:00 GMT
I just recovered the contents of this site after a two-year hiatus.
I'm going to try to dig up some other old stuff, too.
I should really rebuild this whole site using Ruby on Rails and some
Ajax goodness. But that's going to have to wait until I ship some
software at work and take care of other personal projects.
Tags Rails, Ruby | no comments