class Bundler::CLI::Gem

def ask_and_set_test_framework

def ask_and_set_test_framework
  return if skip?(:test)
  test_framework = options[:test] || Bundler.settings["gem.test"]
  if test_framework.to_s.empty?
    Bundler.ui.confirm "Do you want to generate tests with your gem?"
    Bundler.ui.info hint_text("test")
    result = Bundler.ui.ask "Enter a test framework. rspec/minitest/test-unit/(none):"
    if /rspec|minitest|test-unit/.match?(result)
      test_framework = result
    else
      test_framework = false
    end
  end
  if Bundler.settings["gem.test"].nil?
    Bundler.settings.set_global("gem.test", test_framework)
  end
  if options[:test] == Bundler.settings["gem.test"]
    Bundler.ui.info "#{options[:test]} is already configured, ignoring --test flag."
  end
  test_framework
end