mercredi 7 janvier 2015

How to include user input in this particular RSPEC test?

I want to ask the user for an input before the test is run? The "response" will be a constant that is located in a relative file and which is an array of strings that I will iterate through and run the test only for those "spaces". What's the best way to do this? Is this possible?



puts "Which space would you like to warm-up?"
puts "Choices: CUSTOMERS, ACCEPTANCE"
response = gets.chomp

"#{response}".each do |space|
puts "Warming dashboards for #{space} ... "
feature "Warm Up Birst Cache" do
before(:all) do
@warmer = CacheWarmer.new(space)
@warmer.login
end

scenario 'Load the dashboard' do
DASHBOARDS.each do |dashboard|
puts "Warming up Birst cache for #{dashboard} ... "
@warmer.load(dashboard)
end
end
end
end


Currently I have it as is, and get the following error:



undefined method `each' for "require_relative '../cache_helper'":String (NoMethodError)

Aucun commentaire:

Enregistrer un commentaire