Sha256: 795c50ed98c6864a1eb59fb83bf53ce08b1761ee34ea1860687f6cce5c757946

Contents?: true

Size: 1.61 KB

Versions: 4

Compression:

Stored size: 1.61 KB

Contents

$:.unshift "."
require File.join(File.dirname(__FILE__), 'spec_helper')
require File.join(File.dirname(__FILE__), 'store_helper')

describe "SQLite3 Store" do
  before(:all) do
    FileUtils.rm_rf(TMP_DIR)
    Dir.mkdir(TMP_DIR)
    @dbfile = File.join(TMP_DIR, "sqlite3.db")
    @identifier = URIRef.new("http://identifier")
  end
  
  before(:each) do
    @store = SQLite3Store.new(@identifier, :path => @dbfile)
  end
  
  after(:all) do
    FileUtils.rm_rf(TMP_DIR)
  end
  
  after(:each) do
    FileUtils.rm(@dbfile) if File.file?(@dbfile)
  end
  
  subject { @store }
  it_should_behave_like "Store"
  it_should_behave_like "Context Aware Store"

  it "should destroy DB file" do
    subject.destroy
    File.exists?(@dbfile).should be_false
  end

  it "should close db" do
    subject.close
  end
  
  it "should find contexts with type" do
    triple = Triple.new("http://foo", RDF_TYPE, "http://baz")
    subject.add(triple, nil)
    subject.contexts(triple).length.should == 1
  end
  
  it "should find triples with typed literal" do
    triple = Triple.new("http://foo", RDF_TYPE, Literal.build_from(1.1))
    subject.add(triple, nil)
    subject.contexts(triple).length.should == 1
  end
  
  it "should find triples with untyped literal and lang" do
    triple = Triple.new("http://foo", RDF_TYPE, Literal.untyped("foo", "en-US"))
    subject.add(triple, nil)
    subject.contexts(triple).length.should == 1
  end
  
  it "should find contexts pattern triple" do
    triple = Triple.new("http://foo", RDF_TYPE, "http://baz")
    subject.add(triple, nil)
    subject.contexts(Triple.new(nil, nil, nil)).length.should == 1
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rdf_context-0.5.9.1 spec/sqlite3_store_spec.rb
rdf_context-0.5.9 spec/sqlite3_store_spec.rb
rdf_context-0.5.8.2 spec/sqlite3_store_spec.rb
rdf_context-0.5.8.1 spec/sqlite3_store_spec.rb