When writing tests with JasmineJS I have many tests that have similar beforeEach/afterEach code.
Is there a way to implement an inheritance model using JasmineJS tes
Jasmine does allow you to put beforeEach
and afterEach
outside of a describe
call. In this way you can have setup and teardown that is global for all of your specs. Your logout()
call seems like it might be a good candidate for global teardown, and if all of your specs login as an admin, you could move that out to global scope as well.
For things that are used in some, but not all, specs, having a method like your login_as_admin()
seems like the best way to consolidate that logic in one place.