db driver registration

This commit is contained in:
Brian J. Cardiff 2016-01-28 19:41:12 -03:00
parent 177e12bb60
commit cc1545a58e
3 changed files with 43 additions and 0 deletions

View file

@ -0,0 +1,19 @@
require "spec"
require "db"
class DummyDriver < DB::Driver
end
DB.register_driver "dummy", DummyDriver
describe DB::Driver do
it "should get driver class by name" do
DB.driver_class("dummy").should eq(DummyDriver)
end
it "should instantiate driver with options" do
driver = DB.driver "dummy", {"host": "localhost", "port": "1027"}
driver.options["host"].should eq("localhost")
driver.options["port"].should eq("1027")
end
end