Simple way to supply test input for gets?

Hi there,
I’m pretty new to rspec and have not been able to figure out how to run
a basic test that allows me to substitute test input for real user input
collected by ‘gets.’ I have a command line program that asks the user
for a CSV file name and then converts that to a database. Now, I know
this works already, but I’d like to make a test for it and other similar
operations that require user input.

Here’s the code in it’s most basic form:
puts “What is the name of your CSV file?”
user_csv = gets.chomp
original_dataset = Statsample::CSV.read(’./’ + user_csv)

What I’d like to be able to do is have rspec automatically substitute
‘test.csv’ for whatever would normally be entered by the user. This test
I put together below doesn’t pass obviously, because there is no
substituted value for that user input.

Test in need of fixing:
class DatasetGetter
describe “#get_original_dataset” do
let(:dataset_getter) { DatasetGetter.new }

it 'should produce a Statsample Dataset object' do
dataset_getter.original_dataset.class.should ==

‘Statsample::Dataset’
end
end
end

Is there a relatively easy way to do this? Thanks for the help!