spec/db_spec.rb in knjrbfw-0.0.28 vs spec/db_spec.rb in knjrbfw-0.0.29
- old
+ new
@@ -6,11 +6,12 @@
it "should be able to handle various encodings" do
#I never got this test to actually fail... :-(
require "knj/db"
require "knj/os"
- require "sqlite3" if !Kernel.const_defined?("SQLite3")
+ require "rubygems"
+ require "sqlite3" if !Kernel.const_defined?("SQLite3") and RUBY_ENGINE != "jruby"
db_path = "#{Knj::Os.tmpdir}/knjrbfw_test_sqlite3.sqlite3"
File.unlink(db_path) if File.exists?(db_path)
db = Knj::Db.new(
@@ -25,9 +26,18 @@
{"name" => "id", "type" => "int", "autoincr" => true, "primarykey" => true},
{"name" => "text", "type" => "varchar"}
]
})
+
+
+ #Get a list of tables and check the list for errors.
+ list = db.tables.list
+ raise "Table not found: 'test'." if !list.key?("test")
+ raise "Table-name expected to be 'test' but wasnt: '#{list["test"].name}'." if list["test"].name != "test"
+
+
+ #Test revision to create tables.
schema = {
"tables" => {
"test_table" => {
"columns" => [
{"name" => "id", "type" => "int", "autoincr" => true, "primarykey" => true},
\ No newline at end of file