Showing posts with label rails 3.1 integration test. Show all posts
Showing posts with label rails 3.1 integration test. Show all posts

Tuesday, February 28, 2012

Rails 3.1.0 - functional/integration test to test AJAX

Integration test with ajax achieved by means of calling xhr like below
xhr :req_method, :path, :parameters, :headers

xhr :get, '/users/new' # new user action

xhr :delete, '/users/20' # delete user

In integration test, you need to specify full path to make it work.

Incase of Functional test, we can simply specify the name of action.

Cheers,
Vadivelan.K