Reduce code duplication in select2_tests.