We add a count: option to assert_has/2 and refute_has/2 (making them 3-arity functions)
That allows people to test things like the exact number of elements in a list (e.g. with .posts):
|> assert_has(".posts", count: 3)
Or refuting an exact number of elements:
|> refute_has(".posts", count: 2)
(i.e. refute that there are 2 posts. 1 post is fine. More than 2 is fine).
What about text functions?
For now, we leave the other 3-arity assert and refute functions as they are -- meaning they take the text as the third argument.
Before we officially roll out this count: option, it would be nice to bring the text functions inline, but rather than turning them into 4-arity functions, we should make the text itself an option.
In other words, rather than having this:
|> assert_has(".posts", "hello", count: 3)
Maybe we should have:
|> assert_has(".posts", text: "hello", count: 3)
Maybe when we try to implement that, we'll figure out it'll be better to just keep the text as its own argument, but moving it to an option is a decent idea for now.
We add a
count:
option toassert_has/2
andrefute_has/2
(making them 3-arity functions)That allows people to test things like the exact number of elements in a list (e.g. with
.posts
):Or refuting an exact number of elements:
(i.e. refute that there are 2 posts. 1 post is fine. More than 2 is fine).
What about
text
functions?For now, we leave the other 3-arity assert and refute functions as they are -- meaning they take the
text
as the third argument.Before we officially roll out this
count:
option, it would be nice to bring the text functions inline, but rather than turning them into 4-arity functions, we should make the text itself an option.In other words, rather than having this:
Maybe we should have:
Maybe when we try to implement that, we'll figure out it'll be better to just keep the
text
as its own argument, but moving it to an option is a decent idea for now.