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. Aaron On Wed, Feb 19, 2014 at 8:15 AM, Nicholas Wieland <[email protected]> wrote: > Hi, I'm trying to test an external service. I like my code, I really > dislike the tests (probably because I'm not able to write them). > > https://gist.github.com/ngw/9091503 > > Someone has some examples of "good style" or some advice for me? For > example, I really dislike the fact I must stub the whole > class, it seems to me error prone and too verbose. > The pending spec doesn't even pass (that's why it's pending), and I have > no idea why I need all that stuff: to me I should only stub > the query method to test it in another spec later, but I'm apparently not > able to make it work. > > TIA, > 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/adea0df9-ff10-4c87-af5e-97504ba45a54%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/CAKCESdiAnjaT%3DNfPxsFgrbtvn3%3DY3DqwgJCA6pCUOeZ%3DyK94vg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
