Forgus / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

Where block parameters should be able to reference each other #387

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
It would be nice if parameters defined with `<<` could reference previous 
definitions. Then one could do things like this to make one's tests more robust 
to refactoring:

    where:
        IDENTIFIER = 'fooId'
        snippet << ["""<label for="${IDENTIFIER}"/><input type="text" id="${IDENTIFIER}" />"""]

However, this is not currently possible:

- Parameters defined with `=` can reference ones defined previously
- Parameters defined with `<<` or in table format cannot reference ones defined 
previously, not even those defined with `=`

Example: 
https://github.com/emlun/spock-parameter-cross-reference-fail/blob/master/src/te
st/groovy/Foo.groovy

It would also be nice if parameters in table format could reference other 
parameters as well, but I suspect its usefulness is more limited.

Original issue reported on code.google.com by lundberg...@gmail.com on 11 Feb 2015 at 11:37