[Rspec-devel] rails_plugin_fix merged to trunk
luke at agileevolved.com
Tue Aug 1 07:37:03 EDT 2006
Thanks for posting this - I can't believe I hadn't come across this
before. For mocks, I'm pretty happy with the mocking built into
rSpec (or FlexMock when I'm using Test::Unit) but I really like the
look of Stubba - far more elegant than monkey patching existing
classes with stub methods.
On 1 Aug 2006, at 12:22, James Mead wrote:
> On 7/31/06, David Chelimsky <dchelimsky at gmail.com> wrote:
>> I want isolated tests for controllers. That's actually why I'm
>> on the mock framework - to support an acts_as_mock plugin that lets
>> you stub out class level methods like new and find. That way
>> controller specs can avoid the database entirely and specs for model
>> stuff (like validation) can live in the model where it is
> Hi David. I really like what you guys are doing with RSpec. I was
> wondering if you'd seen Stubba (http://mocha.rubyforge.org). It allows
> you to stub class methods like :new and :find and avoid hitting the
> database. Here's a trivial example...
> def test_should_find_expected_product
> expected_product = Product.new
> assert_equal expected_product, Product.find(123)
> - The Product class reverts to its original behaviour after each test.
> - You can specify different return values in different tests.
> - The test is explicit, because the return value is defined in the
> We're using it on Rails projects at Reevoo.
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
More information about the Rspec-devel