我有一个Rspec文件,在每个“describe”测试块之前和之后运行以下方法:
def self.reset
commands = [
"del #{CATS_DB_FILE}", #the "del" was changed from "rm" for windows
"cat #{CATS_SQL_FILE} > sqlite3 #{CATS_DB_FILE}" # | was used before (pipe in linux)
]
commands.each { |command| `#{command}` }
DBConnection.open(CATS_DB_FILE)
end
我正在Windows命令行中运行所有这些。出于某种原因,数据库反复出现过多;似乎数据库本身并没有“清除”,因此当运行另一个测试块时,会再次添加相同的属性。上面commands
数组中的语法是否正常?对所有这些都是新的,会感激任何建议!