Factor out configuration of spec tasks

[ci skip]
Fix a trivial bug

[ci skip]