[rspec-devel] dogfood time?

David Chelimsky dchelimsky at gmail.com
Sat Oct 14 15:57:28 EDT 2006


On 10/14/06, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
> On 10/14/06, Brian Takita <brian.takita at gmail.com> wrote:
> > On 10/14/06, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
> >
> > > On 10/11/06, David Chelimsky <dchelimsky at gmail.com> wrote:
> > > > On 10/11/06, Dave Astels <dastels at daveastels.com> wrote:
> > > > > -----BEGIN PGP SIGNED MESSAGE-----
> > > > > Hash: SHA1
> > > > >
> > > > >
> > > > > On 10-Oct-06, at 10:27 PM, aslak hellesoy wrote:
> > > > >
> > > > > > A while ago I brought up the idea of making RSpec self-hosting. I.e.
> > > > > > completely ditch RSpec's own Test::Unit tests and use RSpec to
> > verify
> > > > > > itself during the build process.
> > > > > >
> > > > > > One of the counter arguments that came up (I think it was Dave) was
> > > > > > "what if we have bugs that get masked".
> > > > > >
> > > > > > I think that at this point RSpec core is mature enough to make it
> > > > > > worth the risk. I think the risk of having masked bugs is minimal -
> > I
> > > > > > think we'd discover it quickly if it happened.
> > > > > >
> > > > > > What do you think? Is it time to trust our own tool and eat our own
> > > > > > dogfood?
> > > > > > (We'd check in the test2spec generated translations, reformat them
> > and
> > > > > > delete the Test::Unit tests plus test2spec)
> > > > >
> > > > > I think you're right that it's ready for that now.
> > > > >
> > > > > +1
> > > >
> > > > +1
> > > >
> > > > One word of caution on this. There are test/unit tests that don't get
> > > > translated in the build because they test things like the ability of
> > > > partial mocks to attach themselves to the Specification that is
> > > > current running. When running a Specification INSIDE a Specification,
> > > > the mocks attach themselves to the wrong spec. So this area will need
> > > > to be restructured such that we can translate all of the specs before
> > > > we follow through on this.
> > > >
> > >
> > > I have created branches/dogfood for this. Work done so far:
> > >
> > > * Checked in translated specs under the specs folder
> > > * Translated by hand specs that didn't translate (mock_spec.rb,
> > > context_spec.rb and a couple of others)
> > > * Deleted test2spec and all references in the doco and the Rakefile
> > > * Code coverage is now up from 95.8% to 98.3%
> >
> > Awesome.
> >
> > > Remaining work:
> > > * Delete the Test::Unit tests
> > > * Replace curlies with do/end (A regexp search/replace should do fine)
> > > * Indent/reformat the specs so they look nice.
> >
> > Was it difficult to do? Are there any rough areas?
> >
>
> It was surprisingly easy and fun. Here is what I did:
>
> 1) I tweaked the test2spec setting a little so the generated specs
> were written to where I wanted to check them in.
> 2) I set up a spec task to run the translated specs - *with* rcov.
> 3) I ran rake spec. All the specs passed (no surprise - test2spec
> translated specs have been running as part of our pre_commit build for
> months)
> 4) Looked at the rcov report and noticed there was a bunch of red
> (non-covered code) that was otherwise covered OK by Test::Unit.
> 5) Opened a file that had poorer coverage with RSpec than with
> Test::Unit and put a raise "FIXME" in some of the red code.
> 6) Ran rake test to see what test would fail (rake spec would still pass)
> 7) Verified that the failing test had indeed not been translated.
> 8) Translated it manually.
> 9) Removed the temporary raise "FIXME"
> 10) Went back to 3 until coverage was good again (it actually ended up
> being better since I also yanked the test2spec code)
>
> This whole effort had been extremely hard had it not been for
> test2spec and rcov. A last heroic effort for test2spec which has now
> been put to rest.
>
> > > Does anyone know of a tool that can format badly formatted ruby code
> > nicely?
> >
> >
> > Eclipse RDT? Textmate?
> >
>
> I don't think they can do it. If someone knows how to, please let me
> know the keyboard shortcuts or menu options.
>
> > > I'd like to get this back to trunk as soon as possible to avoid
> > > divergence. Any objections if I merge back before we've sorted the
> > > curlies/formatting issues?
> >
>
> I'm actually done with the curlies and am now formatting by hand. It's
> not that bad.
> I'll merge to trunk tomorrow unless someone says no.

One other thing - not necessary before merging - I notice many spec
files look like this:

module Spec
  module Mocks
    context "xyz" do
      ...
    end
  end
end

I'd like to kill the module declarations.

Great work on this Aslak. This is a really exciting step for us.

Thanks,
David

>
> > That sounds like a good idea.
> >
> > > Aslak
> > >
> > > > That said, I love the idea of rspec spec'ing itself.
> > > > _______________________________________________
> > > > 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
> >
> >
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>


More information about the rspec-devel mailing list