Why should I use RSpec or shoulda with Rails?

2020-05-15 07:03发布

I am setting up a rails app and I just finished making some unit tests and my friend said that apparently fixtures are no longer cool and people are now using RSpec or shoulda. I was wondering what the actual benefits are to use these other toolkits. Any information at all is appreciated.

-fREW

8条回答
一夜七次
2楼-- · 2020-05-15 08:05

RSpec is way more powerful because it's far easier to both read and write tests in. It's also very elegant when using mocks and stubs, a concept which will become extremely useful once you start using them in your tests. Try it in a simple test app (NON RAILS!) and you'll see how elegant your specs are versus the equivalent standard testing.

查看更多
对你真心纯属浪费
3楼-- · 2020-05-15 08:07

You may use testing framework like Cucumber which is even more faster than RSpec..

查看更多
登录 后发表回答