Thanks for the warning,

We isolate gem updates PR.

Since it's a matcher, Test would broke but I would only have one correction 
to do so I guess it's ok for now.

On Monday, November 23, 2020 at 11:44:08 AM UTC+1 [email protected] wrote:

> Luc,
>
> Please keep in mind that you are dealing with the private API, and it 
> might change even in with a minor RSpec version update.
>
> On Mon, Nov 23, 2020 at 12:29 PM Luc Delmon <[email protected]> 
> wrote:
>
>> Well,
>>
>> I think it's even better. If I can access @message_received at any time 
>> after defining the spy. I might change the matcher itself to iterate over 
>> the list directly. It match more with my objectives.
>>
>> thank you
>>
>> On Friday, November 20, 2020 at 8:32:50 PM UTC+1 [email protected] wrote:
>>
>>> 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/09b204c4-5392-4f74-8903-6e95ad57777bn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/rspec/09b204c4-5392-4f74-8903-6e95ad57777bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/a7e1f918-e0c8-40cf-90f0-1730f3ec7ecan%40googlegroups.com.

Reply via email to