Skip to content

Print pinned variable values in failed assert_called and friends #83

@zachallaun

Description

@zachallaun

When an assert_called using pinned variables fails, you get an error like:

     ** (Patch.MissingCall) 

     Expected but did not receive the following call:

       SomeModule.some_call(^var1, ^var2)

     Calls which were received (matching calls are marked with *):

       1. SomeModule.some_call(:a, 1)
       2. SomeModule.some_call(:b, 2)
       3. SomeModule.some_call(:c, 3)

It would be helpful to know what var1 and var2 were bound to. For example:

     ** (Patch.MissingCall) 

     Expected but did not receive the following call:

       SomeModule.some_call(^var1, ^var2)

     With pinned values:

       ^var1 = :d
       ^var2 = 4

     Calls which were received (matching calls are marked with *):

       1. SomeModule.some_call(:a, 1)
       2. SomeModule.some_call(:b, 2)
       3. SomeModule.some_call(:c, 3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions