Sha256: 57a3a49df3d889ca0e5931afad3a43f351d2087b3828c47d405b11d029afa9f9
Contents?: true
Size: 1.55 KB
Versions: 1
Compression:
Stored size: 1.55 KB
Contents
#encoding: utf-8 require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "Db" do 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") db_path = "#{Knj::Os.tmpdir}/knjrbfw_test_sqlite3.sqlite3" File.unlink(db_path) if File.exists?(db_path) db = Knj::Db.new( :type => "sqlite3", :path => db_path, :return_keys => "symbols", :index_append_table_name => true ) db.tables.create("test", { "columns" => [ {"name" => "id", "type" => "int", "autoincr" => true, "primarykey" => true}, {"name" => "text", "type" => "varchar"} ] }) schema = { "tables" => { "test_table" => { "columns" => [ {"name" => "id", "type" => "int", "autoincr" => true, "primarykey" => true}, {"name" => "name", "type" => "varchar"} ], "rows" => [ { "find_by" => {"id" => 1}, "data" => {"id" => 1, "name" => "trala"} } ] } } } rev = Knj::Db::Revision.new rev.init_db("schema" => schema, "db" => db) begin cont = File.read("#{File.dirname(__FILE__)}/db_spec_encoding_test_file.txt") cont.force_encoding("ASCII-8BIT") db.insert("test", { "text" => cont }) ensure File.unlink(db_path) if File.exists?(db_path) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
knjrbfw-0.0.28 | spec/db_spec.rb |