Fixed variable scope in angular tests