Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created May 23, 2019 03:58
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/b3320ec954636ce0eb32fd5dc7dfd800 to your computer and use it in GitHub Desktop.
Save chelseatroy/b3320ec954636ce0eb32fd5dc7dfd800 to your computer and use it in GitHub Desktop.
Testing Crud Commands
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