Created
May 23, 2019 03:58
-
-
Save chelseatroy/b3320ec954636ce0eb32fd5dc7dfd800 to your computer and use it in GitHub Desktop.
Testing Crud Commands
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" | |
require 'objspace' | |
class TestDatabase < Test::Unit::TestCase | |
def test_get_set_happy_path | |
#These two methods are tested together because isolating them would require opening direct access to database objects. | |
db = Database.new | |
db.set "Crested", "Cardinal" | |
assert_equal("Cardinal", db.get("Crested")) | |
end | |
def test_get_no_value | |
db = Database.new | |
assert_equal("NULL", db.get("NoKey")) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment