Luc,
There's no way you can get this information using this syntax, since by the
moment `"#{??}"` is evaluated, `have_received`'s `matches?` has not yet
been called.
expect(obj).to(
have_received(:a).with(:arg_2).twice,
"#{??}"
)
You may try passing a proc though
https://relishapp.com/rspec/rspec-expectations/v/3-9/docs/customized-message#customize-failure-message-with-a-proc
There, you can use `::RSpec::Mocks.space.proxy_for(a)` and poke around its
`@messages_received`.
So, for:
```
it {
a = double
allow(a).to receive(:foo)
a.foo(1)
expect(a).to have_received(:foo).twice, lambda {
puts
::RSpec::Mocks.space.proxy_for(a).instance_variable_get(:@messages_received)
}
}
```
you'll get:
```
[[:foo, [1], nil]]
```
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/CAAk5Ok_dQQyXfrq-mPfx%2B5xdUK9Qs8VD%2Bq%2BvKDJCZYjfovy%3DrQ%40mail.gmail.com.