How to spec if a slot or other component is called inside a block #849
Unanswered
CharlieWinkwaves
asked this question in
Help
Replies: 1 comment
-
I guess you would have to override call with a stubbed method that yields a mock that listens for the other method to be called twice. Personally, I would try to avoid writing specs that were too coupled to the implementation. Instead, I would render the component and make assertions about the HTML it produced. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When I have for example the following component
render ListComponent.new do |list| list.item(title: 'title1') list.item(title: 'title2') end
I want to check if ListComponent is called, without rendering the component. as speccing the result is part of the ListComponent spec.
But i do want to know if it called the item method twice. The same applies for when I render another component inside the block of a component. How to check if that component is called without having to render everything
render ListComponent.new do |list| list.item(title: 'title1') { render HeaderComponent.new(title: 'header') } end
Does anyone know a way to do this?
Beta Was this translation helpful? Give feedback.
All reactions