cucumber/cucumber-jvm — Issue #244: syntactic sugar tweak for clojure dsl
Author: rplevy-draker
Created: 2012-03-05 17:24:30+00:00
State: open

In my cucumber step definitions I find it convenient to wrap the Given/When/Then macros in what I consider to be slightly better syntactic sugar.

For example:
```
(defmacro Given'
[re binding-form & body]
`(Given ~re (fn ~binding-form ~@body)))
```
It occurred to me that there's no reason to expose the (fn [] ... ) in these macros, for any use case I can imagine. So why not make this the default syntax?

Looking at the way the dsl is implemented I think the best way to do this is not to change the implementation of stepdef at all, but just replace for example ```(def Given stepdef)``` with a defmacro expressions similar the one shown above.

If you agree with this feature, I'll submit a pull request for a modified clojure/src/main/resources/cucumber/runtime/clojure/dsl.clj