Sha256: 987c8060bb7d86af4b80283cd3551c4921171e97fe3b6ada72ae2705fd6e38e6

Contents?: true

Size: 937 Bytes

Versions: 4

Compression:

Stored size: 937 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe SQL::Generator::Function::Predicate, '#visit_veritas_function_predicate_equality' do
  subject { object.visit_veritas_function_predicate_equality(equality) }

  let(:described_class) { Class.new(SQL::Generator::Visitor) { include SQL::Generator::Function::Predicate } }
  let(:attribute)       { Attribute::Integer.new(:id)                                                        }
  let(:object)          { described_class.new                                                                }

  context 'when the right operand is not nil' do
    let(:equality) { attribute.eq(1) }

    it_should_behave_like 'a generated SQL expression'

    its(:to_s) { should eql('"id" = 1') }
  end

  context 'when the right operand is nil' do
    let(:equality) { attribute.eq(nil) }

    it_should_behave_like 'a generated SQL expression'

    its(:to_s) { should eql('"id" IS NULL') }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
veritas-sql-generator-0.0.7 spec/unit/veritas/sql/generator/function/predicate/visit_veritas_function_predicate_equality_spec.rb
veritas-sql-generator-0.0.6 spec/unit/veritas/sql/generator/function/predicate/visit_veritas_function_predicate_equality_spec.rb
veritas-sql-generator-0.0.5 spec/unit/veritas/sql/generator/function/predicate/visit_veritas_function_predicate_equality_spec.rb
veritas-sql-generator-0.0.4 spec/unit/veritas/sql/generator/function/predicate/visit_veritas_function_predicate_equality_spec.rb