Sha256: e5fa474a482d196a5a703374e44adde069756b662bd76a456ab41fcd78688768

Contents?: true

Size: 967 Bytes

Versions: 37

Compression:

Stored size: 967 Bytes

Contents

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

describe "split_array_nil extension" do
  before do
    @ds = Sequel.mock[:table].extension(:split_array_nil)
  end

  specify "should split IN with nil in array into separate OR IS NULL clause" do
    @ds.filter(:a=>[1, nil]).sql.should == "SELECT * FROM table WHERE ((a IN (1)) OR (a IS NULL))"
  end

  specify "should split NOT IN with nil in array into separate AND IS NOT NULL clause" do
    @ds.exclude(:a=>[1, nil]).sql.should == "SELECT * FROM table WHERE ((a NOT IN (1)) AND (a IS NOT NULL))"
  end

  specify "should not affect other IN/NOT in clauses" do
    @ds.filter(:a=>[1, 2]).sql.should == "SELECT * FROM table WHERE (a IN (1, 2))"
    @ds.exclude(:a=>[1, 2]).sql.should == "SELECT * FROM table WHERE (a NOT IN (1, 2))"
  end

  specify "should not affect other types of filters clauses" do
    @ds.filter(:a=>1).sql.should == "SELECT * FROM table WHERE (a = 1)"
  end
end

Version data entries

37 entries across 37 versions & 2 rubygems

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