Sha256: 2eb0970e32cc13929ef066ed45f8210ab004615580dde08a6dd3fa8313895315

Contents?: true

Size: 1.23 KB

Versions: 26

Compression:

Stored size: 1.23 KB

Contents

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

describe "filter_having extension" do
  before do
    @dataset = Sequel.mock[:test].extension(:empty_array_ignore_nulls)
  end

  specify "should handle all types of IN/NOT IN queries with empty arrays" do
    @dataset.filter(:id => []).sql.should == "SELECT * FROM test WHERE (1 = 0)"
    @dataset.filter([:id1, :id2] => []).sql.should == "SELECT * FROM test WHERE (1 = 0)"
    @dataset.exclude(:id => []).sql.should == "SELECT * FROM test WHERE (1 = 1)"
    @dataset.exclude([:id1, :id2] => []).sql.should == "SELECT * FROM test WHERE (1 = 1)"
  end

  specify "should handle IN/NOT IN queries with multiple columns and an empty dataset where the database doesn't support it" do
    @dataset.meta_def(:supports_multiple_column_in?){false}
    db = Sequel.mock
    d1 = db[:test].select(:id1, :id2).filter(:region=>'Asia').columns(:id1, :id2)
    @dataset.filter([:id1, :id2] => d1).sql.should == "SELECT * FROM test WHERE (1 = 0)"
    db.sqls.should == ["SELECT id1, id2 FROM test WHERE (region = 'Asia')"]
    @dataset.exclude([:id1, :id2] => d1).sql.should == "SELECT * FROM test WHERE (1 = 1)"
    db.sqls.should == ["SELECT id1, id2 FROM test WHERE (region = 'Asia')"]
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
sequel-4.22.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.21.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.20.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.19.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.18.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.17.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.16.0 spec/extensions/empty_array_ignore_nulls_spec.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.15.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.14.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.13.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.12.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.11.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.10.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.9.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.8.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.7.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.6.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.5.0 spec/extensions/empty_array_ignore_nulls_spec.rb
sequel-4.4.0 spec/extensions/empty_array_ignore_nulls_spec.rb