Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created May 27, 2019 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chelseatroy/a0b430402a739ba723450eef3f2647bb to your computer and use it in GitHub Desktop.
Save chelseatroy/a0b430402a739ba723450eef3f2647bb to your computer and use it in GitHub Desktop.
Test Deletion with Transaction
...
def test_transaction_with_deletion
db = Database.new
db.set "Homing", "Pigeon"
db.set "Fantail", "Pigeon"
assert_equal(2, db.count("Pigeon"))
db.begin
db.delete "Fantail"
assert_equal(1, db.count("Pigeon"))
assert_equal("NULL", db.get("Fantail"))
db.rollback
assert_equal(2, db.count("Pigeon"))
assert_equal("Pigeon", db.get("Fantail"))
end
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment