Chris,
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 = CustomersController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
def test_index
get :index
assert_response :success
assert_template ''customers/index''
end
...
def test_edit
get :edit, :id => customers(:customer1).id
assert_response :success
assert_template ''customers/edit''
end
... etc.
end
Hope this helps,
Zack
On 8/2/06, Chris T <ctmailinglists@googlemail.com>
wrote:> 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.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>