This project is archived and is in readonly mode.

#3368 ✓stale
Steffen Bartsch

Allow ActiveResource to use IntegrationTests for requests

Reported by Steffen Bartsch | October 12th, 2009 @ 02:52 PM

HttpMock is great to test the client side of a REST API. But if you're responsible for client and server side, it makes sense to do full end-to-end tests from your application's controllers to the client app. Up to now, you'd need to set up a local server to end-to-end-test the ActiveResource requests from the client app against. The supplied patch allows to use the integration test infrastructure to route the ActiveResource requests to the app's controllers.

Here is how you would use it

  require 'active_resource/integration_test_support'

  class APIIntegrationTest < ActionController::IntegrationTest
    test "API requests work end-to-end" do
      ActiveResource::Connection.with_integration_test_session(open_session) do
        result = APIClient.some_method_that_requires_api_access
        assert result

The patch is only a few lines and against 2-3-stable atm.

Comments and changes to this ticket

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

Shared Ticket Bins