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

Advice on extending transpec to handle conversion from RR syntax to RSpec #126

Open
kjvarga opened this issue Feb 23, 2017 · 4 comments
Open

Comments

@kjvarga
Copy link

kjvarga commented Feb 23, 2017

I'm using your awesome gem to upgrade a huge codebase's specs to use expect syntax rather than should. It would not be possible without this tool!

We also want to remove dependency on RR which we use for mocking/stubbing. Now RSpec is really good for that we want to use RSpec mocking.

I forked the gem to have it ignore mock and stub and not convert them to doubles. I want to extend it to convert these to RSpec syntax. It's going to be kinda complicated. And I welcome any advice you have on how to do this.

I don't have a good understanding of how the dynamic analysis is used in the translation phase of the gem.

Here's a sample of what RR syntax can look like:

    mock(User).find { raise 'called' }
    stub!.method_name
    mock!.method_name
    stub(Object.new).method_name.stub!.something
    stub(Object.new).method_name.mock!.something
    mock(Object.new).method_name.stub!.something
    mock!.something.stub!.else
    stub!.something.mock!.else
@kurisu
Copy link

kurisu commented Feb 2, 2018

@kjvarga Did you ever find a solution for migrating from rr to rspec mocking? We're in a similar position, with a large codebase.

@kjvarga
Copy link
Author

kjvarga commented Feb 6, 2018

@kurisu no I haven't. I haven't had time to work on it and there's no bandwidth at work for me to take this on. But I really want to! I'm hopeful that this gem can help, but I have limited understanding of how it works.

@kjvarga
Copy link
Author

kjvarga commented Jan 4, 2019

@kurisu I've written a gem to convert from RR to RSpec. Check it out: https://github.com/kjvarga/rr-to-rspec-converter

It worked pretty well for us on a very large codebase of 6000+ tests. Hopefully it proves useful to you as well.

@yujinakayama thank you very much for your Astrolabe and Transpec tools. They enabled the work in the first place.

Regards,
Karl

@kurisu
Copy link

kurisu commented Jan 5, 2019

@kjvarga awesome, thank you!

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

No branches or pull requests

2 participants