Ruby 找到与同一行不明确的匹配项
我的考试最近开始不及格。在一个单独的项目中工作。它说同一行对它自己来说是模糊的Ruby 找到与同一行不明确的匹配项,ruby,regex,cucumber,Ruby,Regex,Cucumber,我的考试最近开始不及格。在一个单独的项目中工作。它说同一行对它自己来说是模糊的 Cucumber::Ambiguous: Ambiguous match of "Store test data for StoreSource to file": features/step_definitions/write_step_details_definitions.rb:143:in `/^Store test data for ([^"]*) to file$/' featu
Cucumber::Ambiguous: Ambiguous match of "Store test data for StoreSource to file":
features/step_definitions/write_step_details_definitions.rb:143:in `/^Store test data for ([^"]*) to file$/'
features/step_definitions/write_step_details_definitions.rb:143:in `/^Store test data for ([^"]*) to file$/'
You can run again with --guess to make Cucumber be more smart about it
它所指的路线也是:
And(/^Store test data for ([^"]*) to file$/) do |testSite|
#Being Phased out
env = FigNewton.base_url.downcase
env.gsub!( /[\W_]+/,'' )
path = env.upcase
$testSite = testSite + '_'
$fileName = GetFileData.getFileName path, $testSite, $TIME_STAMP
puts "New File name: #{$fileName}"
GetFileData.new()
count = GetFileData.getRowCount $fileName
data = "#{count + 1}) Test for #{testSite}."
data = "\n" + data unless GetFileData.hasContent path, $testSite, $TIME_STAMP
step "Write data to file data: #{data} at Path #{$fileName}"
end
我查看了整个项目,没有看到类似或匹配的正则表达式。任何人都知道这个问题的真正含义。它两次指向同一条线。如果您(暂时)删除第143行的步骤,我甚至不知道还可以发布什么来查找,cucumber会抱怨吗?是否可能您加载了两次该文件?我注释了该调用的所有用法,它不再抱怨。我还检查了是否有东西直接引用了该文件,但在任何地方都没有引用。