Skip to content

RSpec matcher: cast all global_ids/JSON-compatible objects to String before comparing #30

Description

@smudge

The rspec matcher seems to match against the inputs to the JSON serialization, which results in false negatives where a developer might supply a string, but the matcher internally compares against a GlobalID and and fails the test. We should consider doing a round trip to JSON and back for both the event attributes and the dev-supplied attributes, so that the Ruby hashes used for comparison have JSONified scalar values.

# we want this to pass:
journal_event_including(attributes: { owner: "gid://app/model/ID" })

# and this should also pass:
journal_event_including(attributes: { owner: owner.to_global_id.to_s })

# but right now only this passes:
journal_event_including(attributes: { owner: owner.to_global_id })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions