0

我有一个预先编写的 Rails 应用程序,用于处理当前包含在 Rspec 测试套件中的基于订阅的付款。我正在尝试将其合并到使用 Shoulda 测试套件涵盖的 Rails 应用程序中。

我真的很讨厌必须手动将所有测试重写为与 Shoulda 兼容的匹配器,所以我想知道是否有更简单的方法可以做到这一点。我对这两种测试框架都不是很有经验,所以我正在尝试制定一个最佳开始方式的计划。

我听说应该有一些兼容 Rspec 的匹配器,但它们是否涵盖了每个 rspec 匹配器?真的可以这么简单吗?

有没有人做过这样的事情,有多少问题?

4

1 回答 1

0

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.

于 2010-07-12T17:24:20.137 回答