Skip to content

Checking for tag names that include a colon #104

Open
@codyrobbins

Description

@codyrobbins

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions