spek icon indicating copy to clipboard operation
spek copied to clipboard

Skip API feels clunky

Open vanniktech opened this issue 6 years ago • 4 comments
trafficstars

I do find the skipping/ignoring API to be a bit clunky. No matter which way I use it:

it("should do something", skip = Skip.Yes("Some reason"))
it("should do something", Skip.Yes("Some reason"))

Given that we have describe and it that make naming things much easier, would not it make sense to also incorporate the skipping part semantically into the structure? Here's some example of what I mean, although I'm not super happy with it either.

it("should do something", skipping = because("Some reason"))

Maybe someone else has better ideas?

vanniktech avatar Dec 29 '18 10:12 vanniktech

You could always use x variants of describe, context and it.

xit("should do something", reason = "some reason") {
   ...
}

raniejade avatar Jan 09 '19 06:01 raniejade

I could yeah but why not improve the API so that everyone can benefit from it?

vanniktech avatar Jan 09 '19 16:01 vanniktech

@vanniktech wdyt about skip = because("Some reason")? I don't think it's a good idea to rename the existing parameter skip to skipping. Just a side note, one caveat with this approach of skipping vs using x prefixed synonyms is that the IDE won't know that the scope is supposed to be skipped.

raniejade avatar Feb 09 '19 06:02 raniejade

I like it!

vanniktech avatar Feb 09 '19 09:02 vanniktech