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 questionWhat 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
精彩评论