On 2/15/07, Jacob Fugal <lukfugl / gmail.com> wrote:
> On 2/15/07, James Edward Gray II <james / grayproductions.net> wrote:
> > On Feb 15, 2007, at 1:45 PM, Daniel Berger wrote:
> > > It's not a bad idea, but that still wouldn't explicitly indicate to a
> > > user that tests had been skipped - they would merely see fewer tests
> > > run. Plus, it's more work and I'm lazy. :)
> >
> > I think it's a much better design though.
> >
> > For an example of my concerns, what happens if your proposed skip()
> > is called after a few assertions are run in a test?
>
> I agree that the skipping should be done outside of the test method,
> not inside. But explicitness in the output would still be valuable.
> Maybe something like the following:
>
>   class MyTest < Test::Unit::TestCase
>     def test_foo
>       ...
>     end
>
>     def test_bar
>       ...
>     end
>
>     if Time.now.wday == 0
>       skip :test_foo, "The frambulator isn't available on Sundays"
>     end
>   end
>

Now you have test names in two places, and when someone renames
:test_foo to :test_frambulator ??  Whoops!

I like the idea of having a skip assertion inside the test, and it has
to be first assertion used otherwise an exception is raised.

TwP