开发者

Ruby on rails: mock and stub library [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. 开发者_如何学Go

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 8 years ago.

Improve this question

What the best library to use for mock, stub... in ROR application?


Mocha is a quite nice mocking and stubbing library for Ruby.

Have a look at the example usages.

def test_mocking_a_class_method
  product = Product.new
  Product.expects(:find).with(1).returns(product)
  assert_equal product, Product.find(1)
end


RSpec comes with mocking capabilities. There is also FlexMock and rr

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜