Sha256: fc4fd6f5b03317834e15f8e84ec3bc36d7fa9e923e3fd056add200497f9aa81c
Contents?: true
Size: 1.86 KB
Versions: 4
Compression:
Stored size: 1.86 KB
Contents
# encoding: utf-8 require 'spec_helper' describe SQL::Generator::Function::Predicate, '#visit_veritas_function_predicate_inequality' do subject { object.visit_veritas_function_predicate_inequality(inequality) } let(:described_class) { Class.new(SQL::Generator::Visitor) { include SQL::Generator::Function::Predicate } } let(:object) { described_class.new } context 'and the left attribute is optional' do let(:attribute) { Attribute::Integer.new(:age, :required => false) } let(:inequality) { attribute.ne(1) } it_should_behave_like 'a generated SQL expression' its(:to_s) { should eql('("age" <> 1 OR "age" IS NULL)') } end context 'and the right attribute is optional' do let(:attribute) { Attribute::Integer.new(:age, :required => false) } let(:inequality) { Function::Predicate::Inequality.new(1, attribute) } it_should_behave_like 'a generated SQL expression' its(:to_s) { should eql('(1 <> "age" OR "age" IS NULL)') } end context 'and the left is a value' do let(:attribute) { Attribute::Integer.new(:id) } let(:inequality) { Function::Predicate::Inequality.new(1, attribute) } it_should_behave_like 'a generated SQL expression' its(:to_s) { should eql('1 <> "id"') } end context 'and the right is a value' do let(:attribute) { Attribute::Integer.new(:id) } let(:inequality) { attribute.ne(1) } it_should_behave_like 'a generated SQL expression' its(:to_s) { should eql('"id" <> 1') } end context 'and the right is a nil value' do let(:attribute) { Attribute::Integer.new(:id) } let(:inequality) { attribute.ne(nil) } it_should_behave_like 'a generated SQL expression' its(:to_s) { should eql('"id" IS NOT NULL') } end end
Version data entries
4 entries across 4 versions & 1 rubygems