1. Object > Expand. Click OK. Then go to Object > Path > Outline Stroke. The stroke is no longer a stroke: it's an object, and can be filled like any object. Click a gradient swatch in the swatches palette to fill the expanded stroke with a gradient. This is the rainbow gradient in the Default RGB swatches palette.
OR
2. go to Type > Create Outlines, then Object > Path > Outline Stroke, and click a gradient swatch in the swatches palette to apply. (Note: If Create Outlines is grayed out, click the selection arrow in the tool box and try again.)
The results will be the same whichever method you use.


