[rspec-devel] this library needs a better name

Zach Dennis zach.dennis at gmail.com
Mon May 11 21:07:04 EDT 2009


On Sun, May 3, 2009 at 1:57 PM, David Chelimsky <dchelimsky at gmail.com> wrote:
> On Sun, May 3, 2009 at 12:54 PM, David Chelimsky <dchelimsky at gmail.com> wrote:
>> On Sun, May 3, 2009 at 12:40 PM, aslak hellesoy
>> <aslak.hellesoy at gmail.com> wrote:
>>>
>>>
>>> On Sun, May 3, 2009 at 7:32 PM, Mark Wilden <mark at mwilden.com> wrote:
>>>>
>>>> On Sat, May 2, 2009 at 11:12 PM, David Chelimsky <dchelimsky at gmail.com>
>>>> wrote:
>>>>>
>>>>> 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 :)
>>>>
>>>> Since the library is for stubbing models, I actually like the name
>>>> stubble.
>>>
>>> Why not include it in rspec-rails?
>>
>> I may eventually, but I want to prove it out for a bit before adding
>> it to the mile long list of shit that I have to maintain in rspec
>> rails to maintain compatibility.
>
> Also, a bigger problem than the lib name is the method. This doesn't
> speak to me:
>
> stubble(MyModel)
>
> It needs to say "take control of this model class and provide
> instances that are savable (or not) for find, new, create, and
> create!" - all of that in one word.

I like "stub_model" for this as well even though its taken.  Based on
the name you pick, you will potentially need to change the name of
"stub_model", otherwise the API is going to become diluted and less
meaningful. Yes, I know it's one method, but stub_model doesn't do
what you think it does and this new behaviour does what I'd think
stub_model would do.

>
> Was chatting w/ imajes (James Cox) last night and I mentioned the word
> stage, at which point we came up variations of this:
>
> stage(Model).as :savable do |model|
>  # access to the one and only model instance
> end

stage doesn't do it for me. It seems like grasping for straws because
the good names have been taken. In your original post you already gave
two important words... it needs to "stub" stuff on the "model". What
else could be more clear?

>
> Thoughts?

You could keep existing "stub-model" behaviour and add on the new,
until the old is deprecated?

   stub_model(MyModel).as :savable


>
>
>>
>>>
>>> Aslak
>>>
>>>>
>>>> ///ark
>>>>
>>>> _______________________________________________
>>>> rspec-devel mailing list
>>>> rspec-devel at rubyforge.org
>>>> http://rubyforge.org/mailman/listinfo/rspec-devel
>>>
>>>
>>> _______________________________________________
>>> rspec-devel mailing list
>>> rspec-devel at rubyforge.org
>>> http://rubyforge.org/mailman/listinfo/rspec-devel
>>>
>>
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>



-- 
Zach Dennis
http://www.continuousthinking.com (personal)
http://www.mutuallyhuman.com (hire me)
@zachdennis (twitter)


More information about the rspec-devel mailing list