Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created May 27, 2019 02:22
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/81c3b63d28d4fb29bac83d5a105481ab to your computer and use it in GitHub Desktop.
Save chelseatroy/81c3b63d28d4fb29bac83d5a105481ab to your computer and use it in GitHub Desktop.
Rollback Tests
...
def test_rollback_with_transaction
db = Database.new
db.set "Bald", "Eagle"
assert_equal(1, db.count("Eagle"))
db.begin
db.set "Golden", "Eagle"
db.rollback
assert_equal(1, db.count("Eagle"))
assert_equal("NULL", db.get("Golden"))
end
def test_rollback_no_transaction
db = Database.new
assert_equal("No transaction in progress", db.rollback)
end
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment