Translating Rspec tests to Shoulda
I have a pre-written Rails app for handling subscription based payments that is currently covered with an Rspec test suite. I'm trying to merge it into a Rails app that is covered using the Shoulda test suite.
I'd really hate to have to rewrite all the tests into Shoulda compatible matchers manually, so I was wondering if there may be 开发者_运维百科an easier way to do this. I'm not very experienced with either testing framework, so I'm trying to make a plan on the best way to start.
I've heard that Shoulda has some Rspec compatible matchers, but do they cover every rspec matcher? Could it really be as easy as that?
Has anyone had any experience doing something like this, and how much of a problem was it?
I think you might have better luck going to RSpec. To the best of my knowledge, rSpec will run both Test::Unit (and therefore shoulda macros) along with Spec files. If you were to move everything to shoulda, then I think you would end up rewriting many of the tests.
http://blog.davidchelimsky.net/2009/02/02/rspec-works-with-test-unit/
So it should just be a matter of moving your tests over to specs.
I have never tried to run shoulda macros within rspec, only the shoulda matchers. I don't believe it would be that much of an issue though.
精彩评论