Sha256: 62e4e5416355fece6a62d4632b432fdd95f4fe9cedeed1c1f3e399db4051eb9d

Contents?: true

Size: 1.41 KB

Versions: 4

Compression:

Stored size: 1.41 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__),"spec_helper.rb"))
require 'amalgalite/sqlite3'
require 'rbconfig'

describe "Amalgalite::SQLite3" do
  it "is threadsafe is ruby is compiled with pthread support, in this case that is (#{Config::CONFIG['configure_args'].include?( "--enable-pthread" )})" do
    Amalgalite::SQLite3.threadsafe?.should == Config::CONFIG['configure_args'].include?( "--enable-pthread" )
  end

  it "knows if an SQL statement is complete" do
    Amalgalite::SQLite3.complete?("SELECT * FROM sometable;").should == true
    Amalgalite::SQLite3.complete?("SELECT * FROM sometable;", :utf16 => true).should == true
  end
  
  it "knows if an SQL statement is not complete" do
    Amalgalite::SQLite3.complete?("SELECT * FROM sometable ").should == false
    Amalgalite::SQLite3.complete?("SELECT * FROM sometable WHERE ", :utf16 => true).should == false
  end

  it "can produce random data" do
    Amalgalite::SQLite3.randomness( 42 ).size.should == 42
  end

  it "has nil for the default sqlite temporary directory" do
    Amalgalite::SQLite3.temp_directory.should == nil
  end

  it "can set the temporary directory" do
    Amalgalite::SQLite3.temp_directory.should == nil
    Amalgalite::SQLite3.temp_directory = "/tmp/testing"
    Amalgalite::SQLite3.temp_directory.should == "/tmp/testing"
    Amalgalite::SQLite3.temp_directory = nil
    Amalgalite::SQLite3.temp_directory.should == nil
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
amalgalite-0.7.0 spec/sqlite3_spec.rb
amalgalite-0.7.0-x86-mswin32-60 spec/sqlite3_spec.rb
amalgalite-0.7.1 spec/sqlite3_spec.rb
amalgalite-0.7.1-x86-mswin32-60 spec/sqlite3_spec.rb