[Rspec-devel] a commitment to underscores
dchelimsky at gmail.com
Mon Jul 31 07:15:24 EDT 2006
On 7/31/06, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
> On 7/31/06, David Chelimsky <dchelimsky at gmail.com> wrote:
> > If we're really committed to underscores, I think we need to draw the
> > line and really commit to it. Right now, there are numerous methods
> > like this:
> > def an
> > self
> > end
> > This is there to support syntax like this:
> > 37.should.be.an.instance.of Fixnum
> > I'd propose that since the only use of "an" is in the context of
> > "an_instance_of" that we could clean up the should helper (and family)
> > a bit by creating underscored methods like an_instance_of and at_least
> > and at_most (rather than at, least and most), etc.
> > This would mean that we officially stop supporting dots, but it also
> > means that we can't accidentally word things like this:
> > collection.should_have_most(3).entries #missing "at"
> > Thoughts?
> +1 if we can reduce some of the magic
I think we can trim down the cases that sugar needs to cover - all it
should do is look for "should_" and then when it passes control to a
should helper it never really needs to get it back. This should make
things less error prone as time goes on and new features are added.
More information about the Rspec-devel