Class: ViewComponent::TestCase

Inherits:
ActiveSupport::TestCase show all
Defined in:
cybertrain/test/views.rb

Overview

Rails’ (view_component’s) base class for component tests: render_inline and assert_select, beside every assertion of ActiveSupport::TestCase.

Examples:

test/components/card_component_test.rb

require "test_helper"

class CardComponentTest < ViewComponent::TestCase
  test "renders the title" do
    render_inline(CardComponent.new(title: "Hello"))
    assert_select "div.card > h2", text: "Hello"
  end
end

Method Summary

Methods inherited from ActiveSupport::TestCase

fixtures

Methods inherited from Cybertrain::Test::Base

#setup, #teardown