Module: RatatuiRuby::TestHelper::TestDoubles
- Included in:
- RatatuiRuby::TestHelper
- Defined in:
- lib/ratatui_ruby/test_helper/test_doubles.rb
Overview
Test doubles for view testing.
View tests verify widget rendering without a real terminal. Real frames draw to the screen. Real rects come from terminal dimensions. Mocking both by hand is tedious.
This mixin provides MockFrame to capture rendered widgets and StubRect to supply fixed dimensions.
Use them to test view logic in isolation.
Example
-- SPDX-SnippetBegin SPDX-FileCopyrightText: 2026 Kerrick Long SPDX-License-Identifier: MIT-0 ++ frame = MockFrame.new area = StubRect.new(width: 60, height: 20) MyView.new.call(state, tui, frame, area)
widget = frame.rendered_widgets.first assert_equal "Dashboard", widget.block.title
SPDX-SnippetEnd ++