Sha256: a8f0455cdf830fc988985cac2c604ae1aea5bef80902c110d89fa8025e1910f1

Contents?: true

Size: 982 Bytes

Versions: 19

Compression:

Stored size: 982 Bytes

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 "tmpdir"
    require "sqlite3"
    
    db_path = "#{Dir.tmpdir}/knjrbfw_test_sqlite3.sqlite3"
    
    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"}
      ]
    })
    
    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

19 entries across 19 versions & 1 rubygems

Version Path
knjrbfw-0.0.27 spec/db_spec.rb
knjrbfw-0.0.26 spec/db_spec.rb
knjrbfw-0.0.25 spec/db_spec.rb
knjrbfw-0.0.24 spec/db_spec.rb
knjrbfw-0.0.23 spec/db_spec.rb
knjrbfw-0.0.22 spec/db_spec.rb
knjrbfw-0.0.21 spec/db_spec.rb
knjrbfw-0.0.20 spec/db_spec.rb
knjrbfw-0.0.19 spec/db_spec.rb
knjrbfw-0.0.18 spec/db_spec.rb
knjrbfw-0.0.17 spec/db_spec.rb
knjrbfw-0.0.16 spec/db_spec.rb
knjrbfw-0.0.15 spec/db_spec.rb
knjrbfw-0.0.14 spec/db_spec.rb
knjrbfw-0.0.13 spec/db_spec.rb
knjrbfw-0.0.12 spec/db_spec.rb
knjrbfw-0.0.11 spec/db_spec.rb
knjrbfw-0.0.10 spec/db_spec.rb
knjrbfw-0.0.9 spec/db_spec.rb