views:

48

answers:

2

Hi!

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

+3  A: 

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
Mark Byers
A: 

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

Matt