|
View:
New views
15 Messages
—
Rating Filter:
Alert me
|
|
|
this library needs a better nameHey 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 _______________________________________________ rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
|
|
Re: this library needs a better nameOn Sat, May 2, 2009 at 11:12 PM, David Chelimsky <dchelimsky@...> wrote:
Since the library is for stubbing models, I actually like the name stubble. ///ark _______________________________________________ rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
|
|
Re: this library needs a better nameOn Sun, May 3, 2009 at 7:32 PM, Mark Wilden <mark@...> wrote:
Why not include it in rspec-rails? Aslak
_______________________________________________ rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
|
|
Re: this library needs a better nameOn Sun, May 3, 2009 at 12:40 PM, aslak hellesoy
<aslak.hellesoy@...> wrote: > > > On Sun, May 3, 2009 at 7:32 PM, Mark Wilden <mark@...> wrote: >> >> On Sat, May 2, 2009 at 11:12 PM, David Chelimsky <dchelimsky@...> >> 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. > > Aslak > >> >> ///ark >> >> _______________________________________________ >> rspec-devel mailing list >> rspec-devel@... >> http://rubyforge.org/mailman/listinfo/rspec-devel > > > _______________________________________________ > rspec-devel mailing list > rspec-devel@... > http://rubyforge.org/mailman/listinfo/rspec-devel > rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
|
|
Re: this library needs a better nameOn Sun, May 3, 2009 at 12:54 PM, David Chelimsky <dchelimsky@...> wrote:
> On Sun, May 3, 2009 at 12:40 PM, aslak hellesoy > <aslak.hellesoy@...> wrote: >> >> >> On Sun, May 3, 2009 at 7:32 PM, Mark Wilden <mark@...> wrote: >>> >>> On Sat, May 2, 2009 at 11:12 PM, David Chelimsky <dchelimsky@...> >>> 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. 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 Thoughts? > >> >> Aslak >> >>> >>> ///ark >>> >>> _______________________________________________ >>> rspec-devel mailing list >>> rspec-devel@... >>> http://rubyforge.org/mailman/listinfo/rspec-devel >> >> >> _______________________________________________ >> rspec-devel mailing list >> rspec-devel@... >> http://rubyforge.org/mailman/listinfo/rspec-devel >> > rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
|
|
Fwd: this library needs a better nameBegin forwarded message:
_______________________________________________ rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
|
|
Re: Fwd: this library needs a better name
I'm not sure I would have that as a goal. This is so close to underlying mocking and stubbing that abstracting away from it could make it too brittle. Aslak
_______________________________________________ rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
|
|
Re: Fwd: this library needs a better nameOn May 3, 2009, at 1:08 PM, aslak hellesoy <aslak.hellesoy@...> wrote:
Yeah, yeah, yeah. First goal is to make it useful and pleasant. Still want to keep it separate from rspec-rails for the short terrm.
_______________________________________________ rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
|
|
Re: this library needs a better nameOn Sun, May 3, 2009 at 10:57 AM, David Chelimsky <dchelimsky@...> wrote:
stubblize(MyModel) The contraction of "stub model" to "stubble" really speaks to me. :) ///ark _______________________________________________ rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
|
|
Re: this library needs a better nameI love the idea. I think "stubble" is a bit esoteric though, I almost prefer the example with two more lines of code, just for it's readability. Having said that, I haven't been able to come up with a name myself :P
"stub_model" seems perfect, apart from the fact that it's already taken. John Doxey
On Mon, May 4, 2009 at 6:11 AM, Mark Wilden <mark@...> wrote:
_______________________________________________ rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
|
|
Re: this library needs a better nameHow about...
2009/5/4 David Chelimsky <dchelimsky@...>
pwn(MyModel) It needs to say "take control of this model class and provide IN YR MODEL PWNING YR SAVEZ LOL! KTHXBYE
_______________________________________________ rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
|
|
Re: this library needs a better namepimp(MyModel) On Mon, May 4, 2009 at 2:52 PM, Dan North <tastapod@...> wrote: How about... _______________________________________________ rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
|
|
Re: this library needs a better nameOn Sun, May 3, 2009 at 9:52 PM, Dan North <tastapod@...> wrote: How about... pr0n(MyModel) ? :-)
_______________________________________________ rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
|
|
Re: this library needs a better nameOn Sun, May 3, 2009 at 1:57 PM, David Chelimsky <dchelimsky@...> wrote:
> On Sun, May 3, 2009 at 12:54 PM, David Chelimsky <dchelimsky@...> wrote: >> On Sun, May 3, 2009 at 12:40 PM, aslak hellesoy >> <aslak.hellesoy@...> wrote: >>> >>> >>> On Sun, May 3, 2009 at 7:32 PM, Mark Wilden <mark@...> wrote: >>>> >>>> On Sat, May 2, 2009 at 11:12 PM, David Chelimsky <dchelimsky@...> >>>> 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@... >>>> http://rubyforge.org/mailman/listinfo/rspec-devel >>> >>> >>> _______________________________________________ >>> rspec-devel mailing list >>> rspec-devel@... >>> http://rubyforge.org/mailman/listinfo/rspec-devel >>> >> > _______________________________________________ > rspec-devel mailing list > rspec-devel@... > http://rubyforge.org/mailman/listinfo/rspec-devel > -- Zach Dennis http://www.continuousthinking.com (personal) http://www.mutuallyhuman.com (hire me) @zachdennis (twitter) _______________________________________________ rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
|
|
Re: this library needs a better nameOn Mon, May 11, 2009 at 8:07 PM, Zach Dennis <zach.dennis@...> wrote:
> On Sun, May 3, 2009 at 1:57 PM, David Chelimsky <dchelimsky@...> wrote: >> On Sun, May 3, 2009 at 12:54 PM, David Chelimsky <dchelimsky@...> wrote: >>> On Sun, May 3, 2009 at 12:40 PM, aslak hellesoy >>> <aslak.hellesoy@...> wrote: >>>> >>>> >>>> On Sun, May 3, 2009 at 7:32 PM, Mark Wilden <mark@...> wrote: >>>>> >>>>> On Sat, May 2, 2009 at 11:12 PM, David Chelimsky <dchelimsky@...> >>>>> 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 Hey Zach, Thanks for your thoughts on this but at this point I've already announced the library name as stubble and the method it uses is stubbing: stubbing(Thing) do |thing| get :index assigns[:things].should == [thing] end More at http://github.com/dchelimsky/stubble/tree/master Cheers, David > > >> >> >>> >>>> >>>> Aslak >>>> >>>>> >>>>> ///ark >>>>> >>>>> _______________________________________________ >>>>> rspec-devel mailing list >>>>> rspec-devel@... >>>>> http://rubyforge.org/mailman/listinfo/rspec-devel >>>> >>>> >>>> _______________________________________________ >>>> rspec-devel mailing list >>>> rspec-devel@... >>>> http://rubyforge.org/mailman/listinfo/rspec-devel >>>> >>> >> _______________________________________________ >> rspec-devel mailing list >> rspec-devel@... >> http://rubyforge.org/mailman/listinfo/rspec-devel >> > > > > -- > Zach Dennis > http://www.continuousthinking.com (personal) > http://www.mutuallyhuman.com (hire me) > @zachdennis (twitter) > _______________________________________________ > rspec-devel mailing list > rspec-devel@... > http://rubyforge.org/mailman/listinfo/rspec-devel > rspec-devel mailing list rspec-devel@... http://rubyforge.org/mailman/listinfo/rspec-devel |
| Free embeddable forum powered by Nabble | Forum Help |