#140 ✓invalid
Lawrence Pit

Nested describes with before_each

Reported by Lawrence Pit | July 21st, 2009 @ 01:32 PM

JSpec supports nested describes, but it appears not to support before_each blocks within nested describes.

Request to allow before_each blocks within nested describes.

Comments and changes to this ticket

  • TJ Holowaychuk

    TJ Holowaychuk July 24th, 2009 @ 02:39 PM

    • 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

    TJ Holowaychuk July 26th, 2009 @ 07:00 PM

    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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Tiny, full-featured JavaScript BDD framework.

People watching this ticket

Tags

Pages