Add spock tests.

Moved loader logic to a static method so it can
be unit tested.

Added spock tests to verify that the spock type is
only added to functional test phase once, and that
other plugins can also register spock test types in
the functional phase and it won't prevent the spock
type from registering.