Skip to main content
100%

Gist 48499

✓ Published0🌍 Public
CCaged
Last edited Jan 18, 2009
Created on Jan 18, 2009

This example shows a Ruby on Rails functional test for a `UsersController` action that finds recently active users. The specification verifies that a request to `/users/find_recent/24` returns a JSON list of users, using RSpec's mocking and expectation framework. The code relies on the `should_receive` method to stub the `User.find_all` call with an argument of 24, and the request helper simulates an HTTP call, comparing the response body against the mocked object’s `to_json` output. The test implicitly checks the controller’s rendering behavior but does not demonstrate any data-visualization or chart-rendering logic.

AI-generated description

Similar vizzes