[rspec-devel] this library needs a better name

David Chelimsky dchelimsky at gmail.com
Sun May 3 02:12:04 EDT 2009


Hey guys,

I've got a little lib going named stubble. The name is a bad joke
about stubbing models. I'm looking for a better name.

Here's what it does. Instead of this:

      it "redirects to list of registrations" do
        registration = stub_model(Registration)
        Registration.stub!(:create).and_return(registration)
        registration.stub!(:save!).and_return(true)
        post 'create'
        response.should redirect_to(registrations_path)
      end

You can say this:

      it "redirects to list of registrations" do
        stubble(Registration)
        post 'create'
        response.should redirect_to(registrations_path)
      end

More examples here: http://gist.github.com/105857

The basic idea is that you use the stubble method to define a family
of stubs on a model class and the instance it returns for new(),
find(), create(), and create!(). There's a bit more than that, but
it's an infant right now, and there are certainly going to be holes in
it, but the biggest hole at the moment is its name :)

Thoughts?

Thanks,
David


More information about the rspec-devel mailing list