开发者

What are spec/requests good for?

开发者 https://www.devze.com 2023-01-22 03:47 出处:网络
I use RSpec to test my lovely little web app. For integration tests I use Steak. When using Rails generators (yep, I know that this is not the Zen way of doing TDD) there are also some files in spec/r

I use RSpec to test my lovely little web app. For integration tests I use Steak. When using Rails generators (yep, I know that this is not the Zen way of doing TDD) there are also some files in spec/requests generated. As stated on link text it is something similiar to integration test (but I couldn't find much more info).

Are those request specs still recommended when using something like Steak and 开发者_运维技巧Cucumber?


It all depends on what you need and want. The goal of testing is to prove that your app works once, not twice or more times.

I personally write rspec tests for models and helpers. I use cucumber to test that my views and controllers are working the way I expect them to. With this I can prove that my entire app works as I expect it to, so no, I don't use spec/requests.

Occasionally I do use spec/requests to test APIs, but you can do that with cucumber as well.

Some don't like the BDD-way cucumber works and stick with spec/requests. In the end it's all a matter of taste.

0

精彩评论

暂无评论...
验证码 换一张
取 消