Sha256: 291344b269ba181dbdea1b68d9047faeeecf6100c528f31ce3203b744ccc4968

Contents?: true

Size: 739 Bytes

Versions: 21

Compression:

Stored size: 739 Bytes

Contents

require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper")

describe "pg_loose_count extension" do
  before do
    @db = Sequel.mock(:host=>'postgres', :fetch=>{:v=>1}).extension(:pg_loose_count)
  end

  it "should add loose_count method getting fast count for entire table using table statistics" do
    @db.loose_count(:a).must_equal 1
    @db.sqls.must_equal ["SELECT CAST(reltuples AS integer) AS v FROM pg_class WHERE (oid = CAST(CAST('a' AS regclass) AS oid)) LIMIT 1"]
  end

  it "should support schema qualified tables" do
    @db.loose_count(:a__b).must_equal 1
    @db.sqls.must_equal ["SELECT CAST(reltuples AS integer) AS v FROM pg_class WHERE (oid = CAST(CAST('a.b' AS regclass) AS oid)) LIMIT 1"]
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
sequel-4.41.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.40.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.39.0 spec/extensions/pg_loose_count_spec.rb
tdiary-5.0.2 vendor/bundle/gems/sequel-4.37.0/spec/extensions/pg_loose_count_spec.rb
sequel-4.38.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.37.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.36.0 spec/extensions/pg_loose_count_spec.rb
tdiary-5.0.1 vendor/bundle/gems/sequel-4.35.0/spec/extensions/pg_loose_count_spec.rb
sequel-4.35.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.34.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.33.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.32.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.31.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.30.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.29.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.28.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.27.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.26.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.25.0 spec/extensions/pg_loose_count_spec.rb
sequel-4.24.0 spec/extensions/pg_loose_count_spec.rb