Nested describes with before_each
-
TJ Holowaychuk
- State changed from new to invalid
- Tag set to hooks
Yup, you have to be careful about var; If you use it in the correct context it will still work but the scoping
is a bit tricky to see with the grammar version of JSpec. You may want to try something like:describe "foo" var cart before_each cart = new ShoppingCart end end -
TJ Holowaychuk
Generally it shouldn't really matter. Anything developed correctly wont be polluting anyways so polluting during tests is unlikely to cause problems, it never has for me at least. But then again if people are not careful using var in the correct situations they might fuck stuff up haha. Either way there are many ways to deal with it.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.