Works for me:
Matt-Gibsons-iMac:captest matt$ cap -V
Capistrano Version: 3.2.1 (Rake Version: 10.1.0)
Matt-Gibsons-iMac:captest matt$ cap staging test_ordering:start_testing
This task must fire first, before starting task
This task must be in the middle
This task must be the last
All I did was cap init
, paste your code into /lib/capistrano/tasks/test_ordering.rake
, and run.
You say you're using a .cap
file -- the latest Capistrano prefers .rake files, so combined with my correct result would make me think that you might be running across a bug in an old version of Capistrano.
Looking at the recent issues history, I'm guessing it's this bug, fixed in 3.2.1 that you're hitting. Upgrade to 3.2.1 and your problem should disappear.