Fixed plugin_generator test

Template replay needs to happen after bundle.

As we are doing TemplateRecording in apply_rails_template.

here are few commits for changes

8beb42cfbc41753ae4dbb91e16abcd1fb7d00356
9104702be61253f9448ca070a22fc86bb4299555
Merge pull request #12798 from arunagw/plugin-generators-test

Fixed plugin_generator test
sub! can return nil

Revert "drop one more string allocation"

This reverts commit 4d15661d6c46c86a62ee1fc358f4b3ef9dd9f2ea.
Merge pull request #12799 from arunagw/aa-av-test-fixes

Don't call sub! since it may return nil. Reverts 4d15661.