Sha256: 7b0a8b88539a19766a5c3ce752f42aa19824c4c4c8001b605940d0f4f8d4d274

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe 'Veritas::Optimizer::Logic::Predicate::LessThanOrEqualTo::AlwaysFalse#optimizable?' do
  subject { object.optimizable? }

  let(:klass)     { Optimizer::Logic::Predicate::LessThanOrEqualTo::AlwaysFalse }
  let(:attribute) { Attribute::Integer.new(:id)                                 }
  let(:predicate) { left.lte(right)                                             }
  let(:object)    { klass.new(predicate)                                        }

  before do
    predicate.should be_kind_of(Logic::Predicate::LessThanOrEqualTo)
  end

  context 'when left and right are equal' do
    let(:left)  { attribute }
    let(:right) { attribute }

    it { should be(false) }
  end

  context 'when left and right are different types' do
    let(:left)  { attribute                    }
    let(:right) { Attribute::String.new(:name) }

    it { should be(true) }
  end

  context 'when left is always greater than right' do
    let(:left)  { Attribute::Integer.new(:id, :size => 10..20) }
    let(:right) { Attribute::Integer.new(:id, :size => 1..9)   }

    it { should be(true) }
  end

  context 'when left is equivalent to the right' do
    let(:left)  { Attribute::Integer.new(:id) }
    let(:right) { Attribute::Integer.new(:id) }

    it { should be(false) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/optimizer/logic/predicate/less_than_or_equal_to/always_false/optimizable_spec.rb