I would use VCR for this. That records the network traffic and allows you
to play it back. No need for the doubles then.


On Wed, Feb 19, 2014 at 11:23 AM, Nicholas Wieland <[email protected]> wrote:

> On Wednesday, February 19, 2014 4:41:22 PM UTC+1, Aaron Kromer wrote:
>>
>> Just me 2cents:
>>
>> If you own Google::APIClient then this seems to be a normal mockist
>> approach. If however, you do not own that class, and instead get it from a
>> gem or some other 3rd party dependency, maybe check out 
>> VCR<https://github.com/vcr/vcr>.
>> You can then record a live traffic flow then play it back to validate the
>> tests.
>>
>> Aside from that, you could possibly refactor the tests a bit. One general
>> guide I use is that a test should only have a single expectation. Aside
>> from that, other suggestions would largely be my personal preference. I
>> would stick with whatever guidelines your dev group has set forth.
>>
> Hi, I don't own the Google::APIClient, it's an external gem.
> How can you put a single expectations in every test if you have to mock
> the whole service every time? In my example I have to stub 2 calls only to
> instantiate the Google::APIClient, that's why I think it's a bit too
> verbose...
> Don't worry about guidelines, I'm the whole dev group :p
>
> Thanks,
>   ngw
>
>  --
> 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 post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rspec/5716af22-076b-4ac0-a027-bab67c0ceb03%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/CAKCESdgfQo9z9LpL3Fd%2BB0xuUejghQHRUyCgqoPSjyOxgikynw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to