I'm having a really hard time figuring out how to make sure a meta title's content attribute is not empty using either assert_select or assert_tag. I can't figure out how to get it to work together.
To give you a better idea, here's an example of how I would like the test to work:
This should pass:
[meta name="title" content="Hello" /]
This should fail:
[meta name="title" content="" /]
[note: Having no tag at all should also fail]
I got it to work shortly after posting with a little help from IRC and the documentation example as a base. Rather than delete the post I'll keep it up because this was surprisingly annoying to track down.
Here's the code:
assert_select "meta[name=title]" do
assert_select "[content=?]", /.+/
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With