Test that a component has been rendered? #1382
Unanswered
jacob-carlborg-apoex
asked this question in
Q&A
Replies: 1 comment 3 replies
-
@jacob-carlborg-apoex generally, we use test-only selectors for this kind of thing internally: https://github.com/primer/view_components/blob/be1c07750483b3cf9ee67f7bb2db6021858f8bbd/app/lib/primer/test_selector_helper.rb. That being said, I'd love to see support for similar functionality to your example in ViewComponent. Could you propose some API options? I assume we'd want at least Minitest and RSpec options. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've started to experiment with replacing views with components. That is, I'm rendering a component in the controller. I'm using RSpec as the testing framework. I have some exiting request specs [1] that verifies that a certain template is rendered. Example:
Is there a way to make a corresponding verification with components? That is, a test that asserts that a given component have been rendered.
[1] https://relishapp.com/rspec/rspec-rails/v/5-1/docs/request-specs/request-spec
Beta Was this translation helpful? Give feedback.
All reactions