diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 43e298e83..c1b3c69f0 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -10,6 +10,10 @@ nav_order: 5 ## main +* Updates testing docs to include an example of how to use with RSpec. + + *Rylan Bowers* + * Add `--skip-suffix` option to component generator. *KAWAKAMI Moeki* diff --git a/docs/guide/testing.md b/docs/guide/testing.md index dbff2646d..cf344c123 100644 --- a/docs/guide/testing.md +++ b/docs/guide/testing.md @@ -30,6 +30,21 @@ _Note: `assert_selector` only matches on visible elements by default. To match o For debugging purposes, the `rendered_content` test helper outputs the rendered HTML. +## Use with RSpec + +To enable ViewComponent test helpers in RSpec, add: + +```ruby +# spec/rails_helper.rb +require "view_component/test_helpers" + +RSpec.configure do |config| + # ... + + config.include ViewComponent::TestHelpers, type: :component +end +``` + ## Testing Slots ```ruby