Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Commission Tests
require_relative "database"
require "test/unit"
class TestDatabase < Test::Unit::TestCase
...
def test_commit_with_transaction
db = Database.new
db.set "BlueAndGold", "Maccaw"
assert_equal(1, db.count("Maccaw"))
db.begin
db.set "GreenWing", "Maccaw"
db.commit
assert_equal(2, db.count("Maccaw"))
assert_equal("Maccaw", db.get("GreenWing"))
end
def test_commit_no_transaction
db = Database.new
assert_equal("No transaction in progress", db.commit)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.