In the book, Theoden and Aragorn decide on the ride:
‘Do not judge the counsel of Gandalf, until all is over, lord,’ said
Aragorn.
‘The end will not be long,’ said the king. ‘But I will not
end here, taken like an old badger in a trap. Snowmane and Hasufel and
the horses of my guard are in the inner court. When dawn comes, I will
bid men sound Helm’s horn, and I will ride forth. Will you ride with
me then, son of Arathorn? Maybe we shall cleave a road, or make such
an end as will be worth a song – if any be left to sing of us
hereafter.’
‘I will ride with you,’ said Aragorn.
Before they ride out, Aragorn calls out for parlay with the Orcs. He tells the Orcs:
‘I have still this to say,’ answered Aragorn. ‘No enemy has yet taken
the Hornburg. Depart, or not one of you will be spared. Not one will
be left alive to take back tidings to the North. You do not know your
peril.’
Aragorn had faith that Gandalf would come with aid. He even seems to forecast the annihilation of the Orcs by the Huorns. Theoden on the other hand seems to accept his fate, and be determined to die fighting.
But it is clearly Theoden who proposes the ride. So they rode out because they thought it was the end, not because they had faith that Gandalf was coming.