Hi,
I can’t find any information on how to specify the format (like xml,
html, js, …) of a request in a functional controller test.
For example:
I have a create action in my bookmarks_controller which responds to
format.xml and format.html.
If html is requested it should respond with a redirect, if xml is
requested with the http status code :created.
def test_should_create_bookmark_xml
post :create, :bookmark => { :channel_id => 3, :user_id => 1 }
assert_equal old_count+1, Bookmark.count
assert_response :created
assert assigns(:bookmark)
end
def test_should_create_bookmark_html
post :create, :bookmark => { :channel_id => 3, :user_id => 1 }
assert_equal old_count+1, Bookmark.count
assert_redirected_to bookmark_path(1, assigns(:hypermark))
end
How can I specify which format post requests?
lg philipp