rylnd/shpec

add/before block

Opened this issue · 3 comments

add/before block to regroupe setUp or tearDown code.

(should see if either false block, or function)

draft in 481a5be

forget about last draft

Best way to realise this would be to use after and before functions.

  • They should be invoke for each test
  • can be redefined between test
  • shall stay in describe scope

any suggestion on this _specification?_ (before I work on implementation)

On 04/26/15 16:09, Adriean Khisbe wrote:

/forget about last draft/

Best way to realise this would be to use |after| and |before| functions.

  • They should be invoke for each test
  • can be redefined between test
  • shall stay in describe scope

/any suggestion on this /specification/?/ (before I work on implementation)

I guess you would just define the two functions, and let the framework check
for their existence and invoke them, so you don't have to refer to them in the
tests themselves?

What about |setup| and |teardown|? Those are conventional names for such functions.
Names like |before| and |after| don't appear to have any relation to each other.
The name |teardown| at least suggests that it cleans up whatever |setup| left behind.

Flip side: There's no guarantee that |setup| and |teardown| actually do anything like that.
It's still the responsibility of the test writers to make it so.

By whatever name, this could be useful.

Cheers,
Henk

I suggested after and before since we going for integration, rshpec like terminology.

To have some scope I was rather thinking that the describe would set an empty function. (to be more refined if we want the parent describe's to affect the child describes), and that the call would be automatically made by respectively it and end

good week start :)