Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking for tag names that include a colon #104

Open
codyrobbins opened this issue Sep 14, 2022 · 0 comments
Open

Checking for tag names that include a colon #104

codyrobbins opened this issue Sep 14, 2022 · 0 comments

Comments

@codyrobbins
Copy link

codyrobbins commented Sep 14, 2022

We’re using Cloudflare’s ESI include functionality and in our Rails tests we’re trying to check for the presence of the ESI tags like so:

assert_select 'esi:include[src="/foo"]'

Unfortunately this doesn’t find the tag:

Expected at least 1 element matching "esi:include[src="/foo"]", found 0..
Expected 0 to be >= 1.

Every other attempt I’ve come up with to get this to work causes the wheels to fly off in one way or another:

assert_select 'esi\:include[src="/foo"]'
# Nokogiri::XML::XPath::SyntaxError: ERROR: Invalid expression: .//esi\:include[@src="/foo"] | self::esi\:include[@src="/foo"]

assert_select 'esi|include[src="/foo"]'
# Nokogiri::XML::XPath::SyntaxError: ERROR: Undefined namespace prefix: .//esi:include[@src="/foo"] | self::esi:include[@src="/foo"]

I also tried to pass multiple variations of an XPath selector directly using the local-name() function to no avail. Is there simply no way to check for the presence of a tag that includes a colon in its name with assert_select?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant