What problem does it solve?
Writing tests for Discourse requires following specific conventions for fabricators, page objects, request specs, and system tests. This Skill provides the patterns and structure needed to create consistent, maintainable RSpec tests across Discourse core, plugins, themes, and theme components.
Core Features & Use Cases
- Testing Principles: Enforces behavior-focused testing with public boundary assertions, minimal mocking, and readable test structure limited to two nesting levels.
- Specialized Test Types: Covers request specs grouped by controller action, system tests with page objects and Capybara matchers, and theme tests with upload helpers.
- Tracking Helpers: Provides DiscourseEvent.track_events, MessageBus.track_publish, and track_sql_queries for asserting side effects without mocking internals.
- Use Case: When adding a new controller endpoint to a Discourse plugin, use this Skill to generate a request spec that signs in a user, posts to the endpoint, and asserts on response status, parsed body, and persisted state.
Quick Start
Write an RSpec request spec for the Discourse bookmarks controller create action following the project's testing conventions.