Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typhoeus.stub should not be converted to new rspec syntax #4

Closed
myronmarston opened this issue Sep 22, 2013 · 8 comments
Closed

Typhoeus.stub should not be converted to new rspec syntax #4

myronmarston opened this issue Sep 22, 2013 · 8 comments

Comments

@myronmarston
Copy link

First off, great work on this project! If this continues to stay up-to-date with RSpec as we approach the 3.0 release (still a ways off), I plan to promote this and point users to it as an aid to upgrading.

Anyhow, I tried it for the first time tonight to upgrade VCR's specs, and ran into one issue.

Typhoeus provides an HTTP stubbing API in the form of Typhoeus.stub(url, options):

https://github.com/typhoeus/typhoeus/blob/6a59c62d7e8bda81ec726035b79e035aefd8b05c/lib/typhoeus.rb#L66-L85

Transpec attempted to upgrade this to RSpec's allow(...).to receive syntax but it was invalid because ::Typhoeus.stub isn't using rspec's stub at all even though it looks like it. While this isn't really a bug in transpec (how could it know?) I think it could help if transpec maintained a whitelist of known exceptions for things it should not attempt to upgrade, and ::Typhoeus.stub could be on the list. There may be others other users will report in the future.

@yujinakayama
Copy link
Owner

Thanks! Yeah, I'll keep Transpec up-to-date with RSpec.

I think it could help if transpec maintained a whitelist of known exceptions for things it should not attempt to upgrade, and ::Typhoeus.stub could be on the list.

The whitelist solution sounds good to me. Typhoeus seems to be famous and the name is unique enough.

@myronmarston
Copy link
Author

Thanks for the quick fix :).

@myronmarston
Copy link
Author

BTW, I noticed that Excon has a .stub method as well -- it should probably go in the whitelist, too.

@yujinakayama
Copy link
Owner

Thanks. I'll handle it too.

By the way, I'm wondering if there's a way to grep codes of all gems.

@yujinakayama
Copy link
Owner

Thanks! I'll try later.

yujinakayama added a commit that referenced this issue Oct 2, 2013
yujinakayama added a commit that referenced this issue Oct 20, 2013
TODO: Support method invocation on implicit self (no receiver node).

Related to #4.
@yujinakayama
Copy link
Owner

Now Transpec checks whether #stub (and all other methods) is defined by RSpec or not with runtime information, rather than the static whiltelist. :)

@myronmarston
Copy link
Author

👍 Sounds great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants