It always works, just that 0.5 turn means it has quite short duration, if the hero didn't cast that spell on a unit which can move fairly soon after, likely the spell's effect will be gone.
you can check the remaining time of any spell effects on a unit by ctrl-click on it two times.