minitest / minitest-focus

72 stars 9 forks source link

focus on describe blocks under minitest-spec #8

Closed corasaurus-hex closed 9 years ago

corasaurus-hex commented 9 years ago

It would be really nice to be able to run an entire describe block when using minitest-spec.

Something like:

focus
describe "Ninja" do
  it "is stealthy" do
    assert Ninja.stealthy?
  end

  it "is deadly" do
    assert Ninja.deadly?
  end
end
zenspider commented 9 years ago

focus works via the method_added hook. describe creates classes. I'm not sure how one would extend it to work against classes.

For such a thing, I just run a single test file (which are separated per-file).

zenspider commented 9 years ago

I don't think can cleanly be added. describe creates classes and the only real hook for that is inherited. Unfortunately, that's at the opening of the class, not the closing. As such, I can't really get a list of all the methods that were added. It just gets too messy to try to hack in the accounting.

As before, I suggest you structure your files using a one-file-per-class way so you get this for free.