When can a Color Ramp be used to create a gradiant in a Cycles shader?
The ColorRamp node only remaps existing information. So without an input, you will only get a solid color as output (the solid color in the middle of the ramp, to be exact).

This is easily fixed by providing an input, such as a procedural gradient texture node: