MacksMind

Technical Wizardry, Rants, and just a Whiff of Insanity

Entries Tagged ‘Rails’

Verifying select field value with Cucumber and Webrat

I’ve been using Cucumber and Webrat for only a couple months now. Today I needed something new and it wasn’t obvious how to make it work.
Here’s an example of a test in Cucumber:

Given I am Sam
When I follow “Foo”
Then the “Bar” field should contain “Baz”

Which relies on Webrat:

Then /^the “([^"]*)” field should contain “([^"]*)”$/ do [...]

Comments (9)

Using belongs_to in Rails model validations when the parent is unsaved

Can’t get there from here
In one of my Ruby on Rails projects, I have a model validation which is dependent on attributes from a belongs_to parent. Normally, you can refer to a parent model as child.parent and access the parent’s attributes as child.parent.attr. The difficulty arises when the parent object is unsaved. Let’s look at [...]

Comments (5)

Installing Typo Blog Engine and mod_rails for Multiple Accounts

I decided my to use Typo for my new blog, but I wasn’t satisfied to install it in the usual way because I want multiple blogs. This is also my first hands-on experience with mod_rails, so it’s a nice opportunity to play.

The following instructions work for Ubuntu 7.10 (gutsy gibbon), and I’m assuming some level of familiarity with Ubuntu and/or Debian. Same ideas should apply elsewhere though (YMMV). If I’ve glossed over too much, leave a comment and I’ll try to clarify.

Comments (4)