> --
> You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
> To post to this group, send email to spockfr...@googlegroups.com.
> To unsubscribe from this group, send email to spockframewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/spockframework?hl=en.
>
>
--
Hamlet D'Arcy
haml...@gmail.com
The problem is in this line:
then:
res = settingsService.get(path: "templates", query: [X_Security_Token: token.value])
This code doesn't declare a new variable, but reassigns an existing one. It is evaluated as a condition and will fail if the assigned value is false according to Groovy truth. This behavior is almost never desirable, and can give rise to nasty bugs. For example, if you write "x = y" when you really meant "x == y", the condition will almost always be true, and will lead you to believe that x and y are equal even when they aren't.
> If this is no longer possible by design, how should I refactor my test?
The solution is to introduce another variable:
then:
def newRes = ...
Hope this helps.
Cheers,
Peter
--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To post to this group, send email to spockfr...@googlegroups.com.
To unsubscribe from this group, send email to spockframewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spockframework?hl=en.