Created
May 27, 2019 02:09
-
-
Save chelseatroy/a6897879372bb1ef21853d539a142169 to your computer and use it in GitHub Desktop.
Commission Tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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