gmailgem / gmail

A Rubyesque interface to Gmail, with all the tools you'll need.
Other
397 stars 119 forks source link

Use Camcorder to mock IMAP and SMTP #141

Closed jeffcarbs closed 9 years ago

jeffcarbs commented 9 years ago

Fixes #103

Webmock and VCR are only for HTTP so they won't be useful here. Camcorder is a gem that can be used to record and replay arbitrary method calls on a given object. This includes basic configuration for mocking IMAP and SMTP and all the recordings for the existing specs.

jeffcarbs commented 9 years ago

So the build is green when running ruby 2.1.5 and 2.2.0 and it's failing on 1.9 and 2.0. I think given the way Camcorder records things, the order in which method calls are made and the method signature both matter.

I'm going to look into less brittle alternatives. In the meantime, if anyone has any suggestions please let me know.

bootstraponline commented 9 years ago

given the way Camcorder records things, the order in which method calls are made and the method signature both matter.

I wonder if any other projects have tried using Camcorder and found effective work arounds? This seems like it'd be a common issue.

johnnyshields commented 9 years ago

@jcarbo great find, seems Camcorder is probably our best option here. If I understand correctly the failings are due to different IMAP interface on each Ruby version? One option would be to maintain a separate camcorder recording set for each targetted Ruby version, e.g. in spec_helper.rb

Camcorder.config.recordings_dir = "spec/recordings/#{RUBY_VERSION}"
johnnyshields commented 9 years ago

Another option would be old-fashioned manual stubbing of the various IMAP calls. That might ultimately be less effort to maintain than Camcorder.

jeffcarbs commented 9 years ago

@johnnyshields locally it seems like the RUBY_VERSION idea will work, although that means whenever somebody adds a spec they will need to ensure they run it on all versions to get recordings. I'll have some time later tonight to play around with just manually stubbing the IMAP calls so if that's not too bad I'll just switch to that.

Getting a green build is pretty essential to getting this project back on track so I'll try to have this wrapped up tonight/tomorrow.

johnnyshields commented 9 years ago

Agreed green build is our first order of business. Thanks so much for taking the lead on this!

jeffcarbs commented 9 years ago

Closed in favor of #143