rspec-request-testing

Generate RSpec request specs for Rails API endpoints across HTTP methods.

4|Updated Feb 16, 2017
One-click install
npx skills add https://github.com/nekorush14/dotfiles --skill rspec-request-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rspec-request-testing
Source: https://github.com/nekorush14/dotfiles/tree/main/configs/claude/skills/rspec-request-testing
Command: npx skills add https://github.com/nekorush14/dotfiles --skill rspec-request-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides comprehensive request specs to verify API endpoints, HTTP responses, and authentication flows in a full-stack context.

Core Features & Use Cases

  • GET/POST/PUT/DELETE: Validate all HTTP methods and responses.
  • Auth Scenarios: Test authenticated and unauthenticated access.
  • JSON Structures: Ensure response formats meet contracts.
  • Error Handling: Verify error responses and edge cases.

Quick Start

Create specs under spec/requests/ and drive API development with TDD, then run rspec.

Frequently Asked Questions about rspec-request-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write request specs to test API endpoints in Rails?

Request specs test full-stack API behavior by making HTTP requests to your endpoints and verifying responses. Create specs under `spec/requests/`, use RSpec to define GET, POST, PUT, and DELETE tests, then run `rspec` to validate status codes, JSON payloads, and authentication flows.

Can I use RSpec request specs to test authentication and authorization?

Yes. Request specs verify both authenticated and unauthenticated access scenarios. Test login flows, token validation, header handling, and permission checks by making requests with and without credentials, then assert the expected status codes and response behavior.

What's the best way to validate JSON response structures in API tests?

Request specs inspect the parsed JSON response to verify schema, field presence, and data types. Define expectations for payload structure, then make requests and assert the returned JSON matches your contract, catching format mismatches before production.

How do I test error handling and edge cases for API endpoints?

Request specs cover error scenarios by sending invalid parameters, missing headers, or unauthorized requests, then asserting error status codes and response messages. This catches missing validations and ensures consistent error behavior across your API.

Do request specs work for testing pagination and parameter validation?

Yes. Request specs validate parameter handling by passing limit, offset, filter, and sort parameters to endpoints, then verifying paginated responses and validation errors. This ensures your API correctly processes and returns filtered data.

Why use request specs instead of unit tests for API development?

Request specs test the full request/response cycle, including routing, middleware, authentication, and serialization—catching integration issues unit tests miss. They provide test-first coverage for the complete API contract, not just individual methods.