REST and functional tests

Just playing around with converting an apps to the new REST goodness in
edge rails, and I’m trying to work out how to convert/write the
functional tests.

Is the recommended way to explicitly use the actions (e.g. get :show,
:id => …; post :create,…, etc) and test the routes separately, or
duplicate the request, in which case how is that done get “/”, :id => 5
doesn’t work as I think the first parameter is expected to be an action?
Probably really obvious but I’m just not seeing it at the moment.

For functional testing the same methods work fine for restful
routing. Check out simple example below.

class CustomersControllerTest < Test::Unit::TestCase
fixtures :customers

def setup
@controller =
@request =
@response =

def test_index
get :index
assert_response :success
assert_template ‘customers/index’

def test_edit
get :edit, :id => customers(:customer1).id
assert_response :success
assert_template ‘customers/edit’

… etc.


Hope this helps,