mardi 2 juin 2015

Sqlite Database Doesn't "Reset"

I have an Rspec file that runs the following method before and after each "describe" test block:

  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

I'm running all of this in Windows command line. For some reason, the database overpopulates itself repeatedly; it seems that the database doesn't "clear" itself, so when another test block is run, the same attributes are added again. Does the syntax in the commands array above look okay? Kind of new to all this, would appreciate any suggestions!

Aucun commentaire:

Enregistrer un commentaire