I have a card component that when clicked, takes you to a different route in the application. The component is built using Rails ViewComponents. What is the best way to write tests that ensure when a user clicks on the component, they are taken to the correct route?
Here is the .rb file of the View Component:
class LandingCardComponent < ViewComponent::Base
def initialize(title: "", description: "", label: "", path: "")
@title = title
@description = description
@label = label
@path = path
end
end
I suggest testing if there is a link in the rendered view looks like expected.