redding / assert

Assertion style testing framework.
https://github.com/redding/assert
MIT License
10 stars 1 forks source link

"todo" assert macro #129

Closed kellyredding closed 11 years ago

kellyredding commented 11 years ago

This would be a macro to help create "todo tests". These are tests that you know need to be implemented but haven't or don't want to implement yet.

should todo "do something"
test todo "do something else"

would produce

Loaded suite (2 tests)
Running tests in random order, seeded with "xxxxx"
SS

SKIP: should do something else
TODO
/path/to/tests.rb:xx

SKIP: should do something
TODO
/path/to/tests.rb:xx

2 results: 2 skip

(0.000251 seconds)

It should be the equivalent of doing this:

should "do something" do
  skip 'TODO'
end

should "do something else" do
  skip 'TODO'
end
kellyredding commented 11 years ago

@jcredding thoughts? this is something i frequently do while testing, but, as you know, I'm lazy and don't want to type this much. Having a more succinct way to do this would encourage me to do it more often.

Macros would make this implementation pretty easy, I think.

Anyway, wanted to write my thoughts down.

jcredding commented 11 years ago

@kellyredding - I don't have any problem with this. It's a little specific (to your workflow), but I think it's pretty harmless. I don't love how "should todo " reads, but that's really minor to me. I do like the output with the TODO in it.

Typically when I go writing out a bunch of test stubs, I just leave them with empty procs. I don't remember if this skips or what it does exactly, but it works for me. I'm not sure if a skip has a default message, but I wouldn't mind if it defaulted to TODO, then maybe you wouldn't have to add the extra syntax to the DSL. I'm fine with it either way though.

kellyredding commented 11 years ago

@jcredding cool. Instead of adding a 'todo' macro for this, i'll just do this behavior anytime a should (or test) is called with no block. This case skips already an I think that pretty well implies "todo".

kellyredding commented 11 years ago

(notes) "closed" (via a different implementation) in #130