Refactor jasmine part of spec tests