[英]Cucumber features/Rspec with third party oAuth API
I am using cucumber and RSpec for my new ruby on rails application and will be using some third party oAuth APIs to send/retrieve data. 我正在将Cucumber和RSpec用于我的新的Rails红宝石应用程序,并将使用一些第三方oAuth API来发送/检索数据。 I am fairly new to both cucumber and RSpec and have never had to implement third party functionality like this before.
我对Cucumber和RSpec都是陌生的,以前从未实现过这样的第三方功能。 What is the best way to handle this from a spec and feature writing perspective?
从规范和功能编写的角度来看,最好的方法是什么? I know I shouldn't be querying the services directly, because I can't spec for them being up or down, etc, so I'm sure I will need to stub/mock some objects/functions.
我知道我不应该直接查询服务,因为我不能指定它们是向上还是向下,等等,所以我确定我需要对一些对象/功能进行存根/模拟。 Any help in this matter would be appreciated.
在这方面的任何帮助将不胜感激。
I use a gem called webmock and stub out the requests with results that I know are good. 我使用了一个名为webmock的gem,并以我知道很好的结果将请求存根。 You can also automatically record requests with EphemeralResponse , but I haven't used that yet.
您还可以使用EphemeralResponse自动记录请求,但是我还没有使用过。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.