Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.