首页 > 解决方案 > 'TypeError:没有将 nil 隐式转换为 String' 错误

问题描述

以下代码(TypeError: no implicit conversion of nil into String)在最后一行返回错误:

And(/^the user makes the following changes in the response file "(.*)" and creates a uri with "(.*)" and wskey:$/) do |readFile, strURI,table|

  strRequestBody = $objFileIO.ReadFile(STR_FILE_SPEC + '/response/' + readFile)
  table.hashes.each do |rows|
    @request_uri = strRequestBody.gsub!(/#{rows[:parameter_in_response]}/, rows[:replace_with])
  end

  puts "this is url" + @request_uri   
end

标签: rubyinstance-variablesstep

解决方案


只需在循环之外定义它,然后勺子就会改变。


推荐阅读