module RatatuiRuby::TestHelper::TestDoubles

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

frame = MockFrame.new
area = StubRect.new(width: 60, height: 20)
MyView.new.call(state, tui, frame, area)

widget = frame.rendered_widgets.first[:widget]
assert_equal "Dashboard", widget.block.title